Initial Commit

This commit is contained in:
Giuseppe Pignataro
2019-02-03 12:30:44 +01:00
parent 1b3dc687b8
commit a8a6c91421
95 changed files with 5246 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
{{ $style := resources.Get "css/main.scss" | resources.ToCSS | resources.Minify}}
{{ $iconfont := resources.Get "font/iconfont.css" }}
<link rel="stylesheet" href="{{ $iconfont.RelPermalink }}">
<link rel="stylesheet" href="{{ $style.RelPermalink }}">

View File

@@ -0,0 +1,15 @@
<footer class="footer">
<div class="copyright">
&copy;
{{ with .Site.Params.since }}
<span itemprop="copyrightYear">{{.}} - {{ now.Year }}</span>
{{ end }}
{{ if .Site.Params.author }}
<span class="author" itemprop="copyrightHolder"><a href="{{ .Site.BaseURL }}">{{ .Site.Params.author }}</a> | </span>
{{ end }}
<span>Developed with ❤️ with <a href="https://gohugo.io" target="_blank" rel="external nofollow noopener noreffer">Hugo</a> & <a href="https://github.com/Fastbyte01/KeepIt" target="_blank" rel="external nofollow noopener noreffer">KeepIt</a></span>
</div>
</footer>
{{ partial "js.html" . }}

View File

@@ -0,0 +1,44 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noodp"/>
{{ with .Site.Params.google_verification }}<meta name="google-site-verification" content="{{ . }}" />{{ end }}
{{ if .PrevInSection }}<link rel="prev" href="{{.PrevInSection.Permalink}}" />{{end}}
{{ if .NextInSection}}<link rel="next" href="{{ .NextInSection.Permalink }}" />{{end}}
<link rel="canonical" href="{{ .Permalink }}" />
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<title>
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ if .IsHome }}
{{ .Site.Title }}
{{ else if .Params.heading }}
{{ .Params.heading }}
{{ else }}
{{ .Title }} | {{ .Site.Title }}
{{ end }}
</title>
<meta name="title" content="{{ if .IsHome }}{{ .Site.Title }}{{ else if .Params.heading }}{{ .Params.heading }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end}}">
{{ partial "css" . }}
{{ if .RSSLink }}
<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
<link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" />
{{ end }}
{{- template "_internal/opengraph.html" . }}
{{- template "_internal/twitter_cards.html" . }}
{{ partial "seo_schema" . }}
</head>
{{ $cdn_url := ""}}
{{ if eq ( getenv "HUGO_ENV" ) "production" }}
{{ with .Site.Params.cdn_url }}
{{ $cdn_url = .}}
{{ end }}
{{ end }}
{{ .Scratch.Set "cdn_url" $cdn_url }}

View File

@@ -0,0 +1,30 @@
<nav class="navbar">
<div class="container">
<div class="navbar-header header-logo">
<a href="javascript:void(0);" class="theme-switch"><i class="iconfont icon-xihuan"></i></a>&nbsp;<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</div>
<div class="menu navbar-right">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</div>
</div>
</nav>
<nav class="navbar-mobile" id="nav-mobile" style="display: none">
<div class="container">
<div class="navbar-header">
<div> <a href="javascript:void(0);" class="theme-switch"><i class="iconfont icon-xihuan"></i></a>&nbsp;<a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></div>
<div class="menu-toggle">
<span></span><span></span><span></span>
</div>
</div>
<div class="menu" id="mobile-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</div>
</div>
</nav>

View File

@@ -0,0 +1,65 @@
<div class="post-warp">
<div class="intro">
{{ $cdn_url := .Scratch.Get "cdn_url" }}
{{ with .Site.Params.avatar}}
{{ $avatar := .}}
<div class="avatar">
<a href="/posts/"> <img src="{{ (printf "%s%s" $cdn_url $avatar)}}"> </a>
</div>
{{ end }}
{{ with .Site.Params.subtitle}}
<h2 class="description">
{{ . }}
</h2>
{{ end }}
</div>
{{ range (.Paginate .Pages).Pages }}
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
</header>
<div class="post-content">
<!--featured_image-->
{{ with .Params.featured_image }}
{{- $img := . -}}
<p><img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image"></p>
{{ end }}
<!-- end featured_image-->
{{ .Summary }}
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime={{.Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} itemprop="datePublished">{{ .Date.Format (.Site.Params.dateFormatToUse | default "2 January 2006") }}</time>
</span>
in
{{ with .Params.categories -}}
<i class="iconfont icon-folder"></i>
<span class="post-category">
{{ range . }}
{{- $name := . -}}
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
<a href="{{ .Permalink }}"> {{ $name }} </a>
{{ end -}}
{{ end }}
</span>
{{- end }}
</div>
{{ with .Params.tags }}
<div class="post-tags">
{{ range . }}
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/">
#{{.}}</a></span>
{{ end }}
</div>
{{ end }}
</div>
</article>
{{ end }}
{{ partial "paginator.html" . }}
</div>

View File

@@ -0,0 +1,17 @@
<div class="intro">
{{ $cdn_url := .Scratch.Get "cdn_url" }}
{{ with .Site.Params.avatar}}
{{ $avatar := .}}
<div class="avatar">
<a href="/posts/"> <img src="{{ (printf "%s%s" $cdn_url $avatar)}}"> </a>
</div>
{{ end }}
{{ with .Site.Params.subtitle}}
<h2 class="description">
{{ . }}
</h2>
{{ end }}
<div class="social-links">
{{ partial "social.html" . }}
</div>
</div>

28
layouts/partials/js.html Normal file
View File

@@ -0,0 +1,28 @@
{{ $cdn_url := .Scratch.Get "cdn_url" }}
{{ $postHasImages := .Scratch.Get "postHasImages"}}
{{ $jquery := resources.Get "/js/jquery.min.js" }}
{{ $lazysizes := resources.Get "/js/lazysizes.min.js"}}
{{ $prettify := resources.Get "/js/prettify.min.js" }}
{{ $dynamic := resources.Get "/js/dynamic.to.top.min.js" }}
{{ $main := resources.Get "/js/main.js" }}
{{ $lihtGallery := resources.Get "/js/lightGallery-all.min.js" }}
{{ $lihtGallery_init := resources.Get "/js/lightGallery-init.js" }}
{{ if .IsPage }}
{{ if $postHasImages }}
<link href="//lib.baomitu.com/lightgallery/1.6.11/css/lightgallery.min.css" rel="stylesheet">
{{ $vendorscript := slice $jquery $lazysizes $prettify $dynamic $main $lihtGallery $lihtGallery_init | resources.Concat "/js/vendor_gallery.js" | resources.Minify }}
<script src="{{ printf "%s%s" $cdn_url $vendorscript.RelPermalink }}" async="" ></script>
{{ else }}
{{ $vendorscript := slice $jquery $prettify $dynamic $main | resources.Concat "/js/vendor_no_gallery.js" | resources.Minify }}
<script src="{{ printf "%s%s" $cdn_url $vendorscript.RelPermalink }}" async=""></script>
{{ end }}
{{ else }}
{{ $main := slice $jquery $main | resources.Concat "/js/vendor_main.js" | resources.Minify}}
<script src="{{ printf "%s%s" $cdn_url $main.RelPermalink }}" async=""></script>
{{ end }}
{{ if eq ( getenv "HUGO_ENV" ) "production" }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}

View File

@@ -0,0 +1,50 @@
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 }}
<ul class="pagination">
{{ with $pag.First }}
<!-- <li class="page-item {{ if not $pag.HasPrev }}disabled{{ end }}">
<span class="page-link">
<a href="{{ .URL }}" aria-label="First"><span aria-hidden="true">&laquo;&laquo;</span></a>
</span>
</li> -->
{{ end }}
<!-- <li class="page-item {{ if not $pag.HasPrev }}disabled{{ end }}">
<span class="page-link">
<a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
</span>
</li> -->
{{ $.Scratch.Set "__paginator.ellipsed" false }}
{{ range $pag.Pagers }}
{{ $right := sub .TotalPages .PageNumber }}
{{ $showNumber := or (le .PageNumber 1) (eq $right 0) }}
{{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) }}
{{ if $showNumber }}
{{ $.Scratch.Set "__paginator.ellipsed" false }}
{{ $.Scratch.Set "__paginator.shouldEllipse" false }}
{{ else }}
{{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }}
{{ $.Scratch.Set "__paginator.ellipsed" true }}
{{ end }}
{{ if $showNumber }}
<li class="page-item {{ if eq . $pag }}active{{ end }}">
<span class="page-link">
<a href="{{ .URL }}">{{ .PageNumber }}</a></li>
</span>
{{ else if ($.Scratch.Get "__paginator.shouldEllipse") }}
<li class="page-item "><span class="page-link" aria-hidden="true">&hellip;</span></li>
{{ end }}
{{ end }}
<!-- <li class="page-item {{ if not $pag.HasNext }}disabled{{ end }}">
<span class="page-link">
<a href="{{ if $pag.HasNext }}{{ $pag.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">&raquo;</span></a>
</span>
</li> -->
<!-- {{ with $pag.Last }}
<li class="page-item {{ if not $pag.HasNext }}disabled{{ end }}">
<span class="page-link">
<a href="{{ .URL }}" aria-label="Last"><span aria-hidden="true">&raquo;&raquo;</span></a>
</span>
</li>
{{ end }} -->
</ul>
{{ end }}

View File

@@ -0,0 +1,9 @@
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h3>Similar articles:</h3>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}

View File

@@ -0,0 +1,102 @@
{{ if .IsHome -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "{{ .Site.BaseURL }}",
{{ if .Site.Author.name -}}
"author": {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
{{- end }}
{{ if .Site.Params.description -}}
"description": "{{ .Site.Params.description }}",
{{- end }}
{{ with .Site.Params.image -}}
"image": "{{ .url | absURL }}",
{{- end }}
{{ with .Site.Params.logo -}}
"thumbnailUrl": "{{ .url | absURL }}",
{{- end }}
{{ with .Site.Copyright -}}
"license": "{{ . }}",
{{- end }}
"name": "{{ .Site.Title }}"
}
</script>
{{/*
"potentialAction": {
"@type": "SearchAction",
"target": "http://example.com/search?&q={query}",
"query-input": "required"
} */}}
{{- else if .IsPage -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "{{ .Title }}",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{ .Permalink }}"
},
{{ if ge (.Param "lua.image.width") 696 -}}
"image": {
"@type": "ImageObject",
"url": "{{ .Param "lua.image.url" | absURL }}",
"width": {{ .Param "lua.image.width" }},
"height": {{ .Param "lua.image.height" }}
},
{{- else if ge .Site.Params.image.width 696 -}}
"image": {
"@type": "ImageObject",
"url": "{{ .Site.Params.image.url | absURL }}",
"width": {{ .Site.Params.image.width }},
"height": {{ .Site.Params.image.height }}
},
{{- end }}
"genre": "{{ .Type }}",
{{ with .Params.tags -}}
"keywords": "{{ delimit . ", " }}",
{{- end }}
"wordcount": {{ .WordCount }},
"url": "{{ .Permalink }}",
{{ if not .PublishDate.IsZero -}}
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
{{- else if not .Date.IsZero -}}
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
{{- end }}
{{ with .Lastmod -}}
"dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
{{- end }}
{{ with .Site.Copyright -}}
"license": "{{ . }}",
{{- end }}
{{ with .Site.Params.publisher -}}
"publisher": {
"@type": "Organization",
"name": "{{ .name }}",
"logo": {
"@type": "ImageObject",
"url": "{{ .logo.url | absURL }}",
"width": {{ .logo.width }},
"height": {{ .logo.height }}
}
},
{{- end }}
{{ if .Params.author -}}
"author": {
"@type": "Person",
"name": "{{ .Params.author }}"
},
{{- else if .Site.Author.name -}}
"author": {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
{{- end }}
"description": "{{ .Description }}"
}
</script>
{{- end }}

View File

@@ -0,0 +1,30 @@
{{ with .Site.Params.Social.Github }}
<a href="https://github.com/{{.}}" target="_blank" rel="me noopener"><i class="iconfont icon-github"></i></a>
{{ end }}
{{ with .Site.Params.Social.LinkedIn }}
<a href="https://linkedin.com/in/{{.}}" target="_blank" rel="me noopener"><i class="iconfont icon-linkedin"></i></a>
{{ end }}
{{ with .Site.Params.Social.Twitter }}
<a href="https://twitter.com/{{.}}" target="_blank" rel="me noopener"><i class="iconfont icon-twitter"></i></a>
{{ end }}
{{ with .Site.Params.Social.Instagram }}
<a href="https://www.instagram.com/{{.}}/" target="_blank" rel="me noopener"><i class="iconfont icon-instagram"></i></a>
{{ end }}
{{ with .Site.Params.Social.Wechat}}
<a href="javascript:void(0);" target="_blank" rel="me noopener" onclick="document.getElementById('lightbox').style.display='inline';"><i class="iconfont icon-wechat"></i></a>
{{end}}
{{ with .Site.Params.Social.Email}}
<a href="mailto:{{.}}" rel="me noopener"><i class="iconfont icon-mail01"></i></a>
{{ end }}
{{ with .Site.Params.Social.Facebook}}
<a href="https://facebook.com/{{.}}" rel="me noopener"><i class="iconfont icon-facebook"></i></a>
{{ end }}
{{ with .Site.Params.Social.Telegram}}
<a href="https://t.me/{{.}}" rel="me noopener"><i class="iconfont icon-telegram"></i></a>
{{ end }}
{{ with .Site.Params.Social.Dribbble}}
<a href="https://dribbble.com/{{.}}" rel="me noopener"><i class="iconfont icon-dribbble"></i></a>
{{ end }}
{{ with .Site.Params.Social.Medium}}
<a href="https://medium.com/{{.}}" rel="me noopener"><i class="iconfont icon-medium-circle-fill"></i></a>
{{ end }}