diff options
author | Giuseppe Pignataro <rogepix@gmail.com> | 2019-02-03 14:30:44 +0300 |
---|---|---|
committer | Giuseppe Pignataro <rogepix@gmail.com> | 2019-02-03 14:30:44 +0300 |
commit | a8a6c91421511e3e0c5669ec0ffff0505f61da70 (patch) | |
tree | df5dc0545bf08ed1cd8cb43c44bd76ca24a3fc4d /layouts | |
parent | 1b3dc687b8bb7a6bc348f07aca1b64af93aff24b (diff) |
Initial Commit
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/404.html | 16 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 15 | ||||
-rw-r--r-- | layouts/_default/list.html | 18 | ||||
-rw-r--r-- | layouts/_default/posts.html | 18 | ||||
-rw-r--r-- | layouts/_default/single.html | 105 | ||||
-rw-r--r-- | layouts/_default/terms.html | 47 | ||||
-rw-r--r-- | layouts/index.atom.xml | 27 | ||||
-rw-r--r-- | layouts/index.html | 7 | ||||
-rw-r--r-- | layouts/page/single.html | 8 | ||||
-rw-r--r-- | layouts/partials/css.html | 5 | ||||
-rw-r--r-- | layouts/partials/footer.html | 15 | ||||
-rw-r--r-- | layouts/partials/head.html | 44 | ||||
-rw-r--r-- | layouts/partials/header.html | 30 | ||||
-rw-r--r-- | layouts/partials/home_post.html | 65 | ||||
-rw-r--r-- | layouts/partials/home_profile.html | 17 | ||||
-rw-r--r-- | layouts/partials/js.html | 28 | ||||
-rw-r--r-- | layouts/partials/paginator.html | 50 | ||||
-rw-r--r-- | layouts/partials/related.html | 9 | ||||
-rw-r--r-- | layouts/partials/seo_schema.html | 102 | ||||
-rw-r--r-- | layouts/partials/social.html | 30 | ||||
-rw-r--r-- | layouts/robots.txt | 66 | ||||
-rw-r--r-- | layouts/rss.xml | 24 | ||||
-rw-r--r-- | layouts/sitemap.xml | 31 |
23 files changed, 777 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..e520c30 --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,16 @@ +{{ define "content" }} + <div class="notfound"> + <h1 class="error-emoji"></h1> + <p class="error-text">/* 404 page not found. */</p> + <p class="error-link"><a href="{{ .Site.BaseURL }}">↑ Back Home ↑</a></p> + </div> + <script> + var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; + var emojiArray = [ + '\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)', + '(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/', + ]; + var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)]; + errorEmojiContainer.appendChild(document.createTextNode(errorEmoji)); +</script> +{{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..3102f82 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}"> + {{ partial "head.html" . }} + <body class=""> + <div class="wrapper"> + {{ partial "header" . }} + <main class="main"> + <div class="container"> + {{ block "content" . }}{{ end }} + </div> + </main> + {{ partial "footer.html" . }} + </div> + </body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..b4c6724 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,18 @@ +{{ define "content" }} +{{ $data := .Data }} +<div class="post-warp archive"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em">- {{ $data.Plural | humanize }}{{ .Title }} -</h2> + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + <h3>{{ .Key }}</h3> + + {{ range .Pages }} + <article class="archive-item"> + <a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a> + <span class="archive-item-date"> + {{ .Date.Format "2 January 2006" }} + </span> + </article> + {{ end }} {{ end }} + {{ partial "paginator.html" . }} +</div> +{{end }}
\ No newline at end of file diff --git a/layouts/_default/posts.html b/layouts/_default/posts.html new file mode 100644 index 0000000..b4c6724 --- /dev/null +++ b/layouts/_default/posts.html @@ -0,0 +1,18 @@ +{{ define "content" }} +{{ $data := .Data }} +<div class="post-warp archive"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em">- {{ $data.Plural | humanize }}{{ .Title }} -</h2> + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + <h3>{{ .Key }}</h3> + + {{ range .Pages }} + <article class="archive-item"> + <a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a> + <span class="archive-item-date"> + {{ .Date.Format "2 January 2006" }} + </span> + </article> + {{ end }} {{ end }} + {{ partial "paginator.html" . }} +</div> +{{end }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..991e125 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,105 @@ +{{ define "content" -}} +{{ $cdn_url := .Scratch.Get "cdn_url" }} +<article class="post-warp"> + <header class="post-header"> + <h1 class="post-title">{{ .Title }}</h1> + <div class="post-meta"> + {{ i18n "Written" }} {{ i18n "by" }} <a href="{{.Site.BaseURL }}" rel="author">{{ if isset .Params "author" }}{{ .Params.author }}{{ else }}{{ .Site.Params.author }}{{ end }}</a> {{ i18n "with" }} ♥ + <span class="post-time"> + {{ i18n "on" }} <time datetime={{.Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} >{{ .Date.Format (.Site.Params.dateFormatToUse | default "2 January 2006") }}</time> + </span> + {{ i18n "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> + </header> + <div class="post-content"> + <!--featured_image--> + + {{ $images := findRE "<img src=\"[^\"|\\\"]*\"" .Content -}} + {{ if ge (len $images) 1}} + {{ $.Scratch.Set "postHasImages" true }} + {{ end }} + + {{ with .Params.featured_image }} + {{- $img := . -}} + <img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image"> + {{ end }} + <!-- end featured_image--> + + {{ $reAltIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" />" }} + {{ $reAltOut := ( printf "<figure><img src=\"/images/ring.svg\" data-sizes=\"auto\" data-src=\"%s$1\" alt=\"$2\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }} + {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }} + + {{ $reAltTitleIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" title=\"([^\"]+)?\" />" }} + {{ $reAltTitleOut := ( printf "<figure><img src=\"/images/ring.svg\" data-src=\"%s$1\" data-sizes=\"auto\" alt=\"$2\" title=\"$3\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }} + {{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }} + + {{ $finalContent }} + </div> + + <div class="post-copyright"> + {{ with .Site.Params.author }} + <p class="copyright-item"> + <span>{{ i18n "Author" }}:</span> + <span>{{ . }} </span> + </p> + {{ end }} + + {{ with .Permalink }} + <p class="copyright-item"> + <span>Link:</span> + <span><a href={{ . }}>{{ . }}</span> + </p> + {{ end }} + {{ with .Site.Params.license }} + <p class="copyright-item lincese"> + {{ . | safeHTML}} + </p> + {{ end }} + </div> + + + <div class="post-tags"> + {{ with .Params.tags }} + <section> + <i class="iconfont icon-tag"></i>{{ i18n "Tag" }}: + {{ range . }} + <span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"> + #{{.}}</a></span> + {{ end }} + </section> + {{ end }} + <section> + <a href="javascript:window.history.back();">{{ i18n "back" }}</a></span> · + <span><a href="{{ .Site.BaseURL }}">{{ i18n "Home" }}</a></span> + </section> + </div> + + <div class="post-nav"> + {{ if .PrevInSection }} + <a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="iconfont icon-left"></i> {{ .PrevInSection.Title}}</a> + {{ end }} + {{ if .NextInSection }} + <a href="{{.NextInSection.Permalink}}" class="next" rel="next" title="{{.NextInSection.Title}}">{{.NextInSection.Title}} <i class="iconfont icon-right"></i></a> + {{ end }} + </div> + + <div class="post-comment"> + {{ if ( .Params.showComments | default true ) }} + {{ if ne .Site.DisqusShortname "" }} + {{ template "_internal/disqus.html" . }} + {{ end }} + {{ end }} + </div> +</article> +{{- end }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..6eba1e3 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,47 @@ +{{ define "content" }} + +{{ $termName := .Data.Plural }} +{{ $terms := .Data.Terms.ByCount }} +{{ $length := len $terms }} +{{ $type := .Type }} +<!-- Categories Page --> +<div class="post-warp {{.Data.Plural}}"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em">- {{ .Data.Plural | humanize }} -</h2> +{{ if and $.Site.Taxonomies.categories (eq $termName "categories") }} + +<div class="categories-card"> +{{ range $terms }} + {{ $term := .Term }} + {{ $pages := .Pages }} + {{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }} + <div class="card-item"> + <div class="categories" > + <a href="{{ .URL }}"><h3> <i class="iconfont icon-folder" style="padding-right: 3px"></i> {{ $term | humanize}} </h3> </a> + {{ range first 5 $pages }} + <article class="archive-item"> + <a href="{{ .URL }}" class="archive-item-link">{{ .Title }}</a> + </article> + {{ end }} + {{ if gt (len $pages) 5 }} + <span class="more-post"> + <a href="{{ .Permalink }}" class="more-post-link">More >></a> + </span> + {{ end }} + </div> + </div> + {{ end }} +{{ end }} +</div> <!-- //categories-card --> + <!-- Tag cloud Page --> +{{ else if and $.Site.Taxonomies.tags (eq $termName "tags") }} + <div class="tag-cloud-tags"> + {{ range $.Site.Taxonomies.tags.ByCount }} + {{ if .Name }} + <a href="/tags/{{ .Name | urlize}}/"> {{ .Name }} <small>({{ .Count }})</small></a> + {{ end }} + {{end}} + </div> + +{{ end }} +</div> +{{end }}
\ No newline at end of file diff --git a/layouts/index.atom.xml b/layouts/index.atom.xml new file mode 100644 index 0000000..9192e0c --- /dev/null +++ b/layouts/index.atom.xml @@ -0,0 +1,27 @@ +<feed xmlns="http://www.w3.org/2005/Atom"> + {{ if .IsHome }} + <title>{{ .Title }}</title> + {{ else }} + <title>{{ .Title }} - {{ .Site.Title }}</title> + {{ end }} + <link href="{{ .Permalink }}index.xml" rel="self"/> + <link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }} + <updated>{{ .Date.Format "02-01-2006T15:04:05-07:00" | safeHTML }}</updated>{{ end }} + <id>{{ .Permalink }}</id>{{ with .Site.Author.name }} + <author> + <name>{{.}}</name>{{ with $.Site.Author.email }} + <email>{{.}}</email>{{end}} + </author>{{end}} + <generator>Hugo -- gohugo.io</generator>{{ range first 15 (where .Data.Pages "Type" "in" .Site.Params.mainSections) }} + <entry> + {{ `<title type="html"><![CDATA[` | safeHTML }}{{ .Title }}]]></title> + <link href="{{ .Permalink }}"/> + <id>{{ .Permalink }}</id>{{ with .Site.Params.Author }} + <author> + <name>{{.}}</name> + </author>{{end}} + <published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published> + <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated> + {{ `<content type="html"><![CDATA[` | safeHTML }}{{ .Content }}]]></content> + </entry>{{ end }} +</feed>
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..b2ffa60 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,7 @@ +{{ define "content" }} + {{ if eq .Site.Params.home_mode "post" }} + {{ partial "home_post.html" . }} + {{ else }} + {{ partial "home_profile.html" . }} + {{ end }} +{{ end }} diff --git a/layouts/page/single.html b/layouts/page/single.html new file mode 100644 index 0000000..c3044db --- /dev/null +++ b/layouts/page/single.html @@ -0,0 +1,8 @@ +{{ define "content" }} +<div class="post-warp archive"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em">{{ .Title }}</h2> + <div class="post-content"> + {{ .Content }} + </div> +</div> +{{end }}
\ No newline at end of file diff --git a/layouts/partials/css.html b/layouts/partials/css.html new file mode 100644 index 0000000..f4f0bd5 --- /dev/null +++ b/layouts/partials/css.html @@ -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 }}"> + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..5ddcb76 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,15 @@ +<footer class="footer"> + <div class="copyright"> + © + {{ 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" . }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..52e155f --- /dev/null +++ b/layouts/partials/head.html @@ -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 }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..41a9c6c --- /dev/null +++ b/layouts/partials/header.html @@ -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> <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> <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>
\ No newline at end of file diff --git a/layouts/partials/home_post.html b/layouts/partials/home_post.html new file mode 100644 index 0000000..60cc8ae --- /dev/null +++ b/layouts/partials/home_post.html @@ -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> diff --git a/layouts/partials/home_profile.html b/layouts/partials/home_profile.html new file mode 100644 index 0000000..f4307d3 --- /dev/null +++ b/layouts/partials/home_profile.html @@ -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>
\ No newline at end of file diff --git a/layouts/partials/js.html b/layouts/partials/js.html new file mode 100644 index 0000000..9af58c6 --- /dev/null +++ b/layouts/partials/js.html @@ -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 }}
\ No newline at end of file diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html new file mode 100644 index 0000000..3ad8d1c --- /dev/null +++ b/layouts/partials/paginator.html @@ -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">««</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">«</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">…</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">»</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">»»</span></a> + </span> + </li> + {{ end }} --> +</ul> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/related.html b/layouts/partials/related.html new file mode 100644 index 0000000..0748ebf --- /dev/null +++ b/layouts/partials/related.html @@ -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 }}
\ No newline at end of file diff --git a/layouts/partials/seo_schema.html b/layouts/partials/seo_schema.html new file mode 100644 index 0000000..1f1cf3b --- /dev/null +++ b/layouts/partials/seo_schema.html @@ -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 }}
\ No newline at end of file diff --git a/layouts/partials/social.html b/layouts/partials/social.html new file mode 100644 index 0000000..3b7fb39 --- /dev/null +++ b/layouts/partials/social.html @@ -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 }} diff --git a/layouts/robots.txt b/layouts/robots.txt new file mode 100644 index 0000000..bf731bb --- /dev/null +++ b/layouts/robots.txt @@ -0,0 +1,66 @@ +User-agent: * + +Disallow: /images/ +Disallow: /js/ +Disallow: /css/ + +User-agent: MJ12bot +Disallow: / + +User-agent: AhrefsBot +Disallow: / + +User-agent: BLEXBot +Disallow: / + +# Block SISTRIX +User-agent: SISTRIX Crawler +Disallow: / +User-agent: sistrix +Disallow: / +User-agent: 007ac9 +Disallow: / +User-agent: 007ac9 Crawler +Disallow: / + +# Block Uptime robot +User-agent: UptimeRobot/2.0 +Disallow: / + +# Block Ezooms Robot +User-agent: Ezooms Robot +Disallow: / + +# Block Perl LWP +User-agent: Perl LWP +Disallow: / + +# Block netEstate NE Crawler (+http://www.website-datenbank.de/) +User-agent: netEstate NE Crawler (+http://www.website-datenbank.de/) +Disallow: / + +# Block WiseGuys Robot +User-agent: WiseGuys Robot +Disallow: / + +# Block Turnitin Robot +User-agent: Turnitin Robot +Disallow: / + +# Block Heritrix +User-agent: Heritrix +Disallow: / + +# Block pricepi +User-agent: pimonster +Disallow: / +User-agent: Pimonster +Disallow: / + +User-agent: SurdotlyBot +Disallow: / + +User-agent: ZoominfoBot +Disallow: / + +Sitemap: {{ "sitemap.xml" | absLangURL }}
\ No newline at end of file diff --git a/layouts/rss.xml b/layouts/rss.xml new file mode 100644 index 0000000..935d316 --- /dev/null +++ b/layouts/rss.xml @@ -0,0 +1,24 @@ +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + <atom:link href="{{.URL}}" rel="self" type="application/rss+xml" /> + {{ range first 15 (where .Data.Pages "Type" "!=" "home") }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{ .Content | html }}</description> + </item> + {{ end }} + </channel> +</rss>
\ No newline at end of file diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml new file mode 100644 index 0000000..797088f --- /dev/null +++ b/layouts/sitemap.xml @@ -0,0 +1,31 @@ +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + {{ range (where .Data.Pages "Section" "!=" "gallery") }} + <url> + <loc>{{ .Permalink }}</loc> + {{ if not .Lastmod.IsZero }} + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod> + {{ end }} + {{ with .Sitemap.ChangeFreq }} + <changefreq>{{ . }}</changefreq> + {{ end }} + {{ if ge .Sitemap.Priority 0.0 }} + <priority>{{ .Sitemap.Priority }}</priority> + {{ end }} + {{ if .IsTranslated }} + {{ range .Translations }} + <xhtml:link + rel="alternate" + hreflang="{{ .Lang }}" + href="{{ .Permalink }}" + /> + {{ end }} + <xhtml:link + rel="alternate" + hreflang="{{ .Lang }}" + href="{{ .Permalink }}" + /> + {{ end }} + </url> + {{ end }} +</urlset> |