diff options
Diffstat (limited to 'themes/beautifulhugo/layouts')
34 files changed, 1226 insertions, 0 deletions
diff --git a/themes/beautifulhugo/layouts/404.html b/themes/beautifulhugo/layouts/404.html new file mode 100644 index 0000000..dc12f2d --- /dev/null +++ b/themes/beautifulhugo/layouts/404.html @@ -0,0 +1,18 @@ +{{ define "header" }}<!-- No header on 404 pages -->{{ end }} +{{ define "main" }} + <div role="main" class="container main-content"> + <div class="text-center"> + <h1 class="error-emoji"></h1> + <p class="error-text">{{ i18n "pageNotFound" }}</p> + </div> + </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 }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/_default/baseof.html b/themes/beautifulhugo/layouts/_default/baseof.html new file mode 100644 index 0000000..25befda --- /dev/null +++ b/themes/beautifulhugo/layouts/_default/baseof.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html lang="{{ .Lang }}" itemscope itemtype="http://schema.org/WebPage"> + <head> + {{ partial "head.html" . }} + </head> + <body> + {{ partial "nav.html" . }} + {{ block "header" . }}{{ partial "header.html" . }}{{ end }} + {{ block "main" . }}{{ end }} + {{ partial "footer.html" . }} + </body> +</html> + diff --git a/themes/beautifulhugo/layouts/_default/list.html b/themes/beautifulhugo/layouts/_default/list.html new file mode 100644 index 0000000..5e52b60 --- /dev/null +++ b/themes/beautifulhugo/layouts/_default/list.html @@ -0,0 +1,63 @@ +{{ define "main" }} + <div class="container" role="main"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + {{ with .Content }} + <div class="well"> + {{.}} + </div> + {{ end }} + <div class="posts-list"> + {{ range .Paginator.Pages }} + <article class="post-preview"> + <a href="{{ .Permalink }}"> + <h2 class="post-title">{{ .Title }}</h2> + + {{ if .Params.subtitle }} + <h3 class="post-subtitle"> + {{ .Params.subtitle }} + </h3> + {{ end }} + </a> + + <p class="post-meta"> + {{ partial "post_meta.html" . }} + </p> + <div class="post-entry"> + {{ if .Truncated }} + {{ .Summary }} + <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a> + {{ else }} + {{ .Content }} + {{ end }} + </div> + + {{ if .Params.tags }} + <div class="blog-tags"> + {{ range .Params.tags }} + <a href="{{ $.Site.LanguagePrefix | absURL }}/tags/{{ . | urlize }}/">{{ . }}</a> + {{ end }} + </div> + {{ end }} + + </article> + {{ end }} + </div> + {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} + <ul class="pager main-pager"> + {{ if .Paginator.HasPrev }} + <li class="previous"> + <a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}/">← {{ i18n "newerPosts" }}</a> + </li> + {{ end }} + {{ if .Paginator.HasNext }} + <li class="next"> + <a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}/">{{ i18n "olderPosts" }} →</a> + </li> + {{ end }} + </ul> + {{ end }} + </div> + </div> + </div> +{{ end }} diff --git a/themes/beautifulhugo/layouts/_default/single.html b/themes/beautifulhugo/layouts/_default/single.html new file mode 100644 index 0000000..7af7637 --- /dev/null +++ b/themes/beautifulhugo/layouts/_default/single.html @@ -0,0 +1,84 @@ +{{ define "main" }} +<div class="container" role="main"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <article role="main" class="blog-post"> + {{ .Content }} + + {{ if .Params.tags }} + <div class="blog-tags"> + {{ range .Params.tags }} + <a href="{{ $.Site.LanguagePrefix | absURL }}/tags/{{ . | urlize }}/">{{ . }}</a> + {{ end }} + </div> + {{ end }} + + {{ if $.Param "socialShare" }} + <hr/> + <section id="social-share"> + <div class="list-inline footer-links"> + {{ partial "share-links" . }} + </div> + </section> + {{ end }} + + {{ if .Site.Params.showRelatedPosts }} + {{ $related := .Site.RegularPages.Related . | first 3 }} + {{ with $related }} + <h4 class="see-also">{{ i18n "seeAlso" }}</h4> + <ul> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + {{ end }} + {{ end }} + </article> + + {{ if ne .Type "page" }} + <ul class="pager blog-pager"> + {{ if .PrevInSection }} + <li class="previous"> + <a href="{{ .PrevInSection.Permalink }}" data-toggle="tooltip" data-placement="top" title="{{ .PrevInSection.Title }}">← {{ i18n "previousPost" }}</a> + </li> + {{ end }} + {{ if .NextInSection }} + <li class="next"> + <a href="{{ .NextInSection.Permalink }}" data-toggle="tooltip" data-placement="top" title="{{ .NextInSection.Title }}">{{ i18n "nextPost" }} →</a> + </li> + {{ end }} + </ul> + {{ end }} + + + {{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (and .Site.Params.comments (ne .Type "page"))) }} + {{ if .Site.DisqusShortname }} + {{ if .Site.Params.delayDisqus }} + <div class="disqus-comments"> + <button id="show-comments" class="btn btn-default" type="button">{{ i18n "show" }} <span class="disqus-comment-count" data-disqus-url="{{ trim .Permalink "/" }}">{{ i18n "comments" }}</span></button> + <div id="disqus_thread"></div> + + <script type="text/javascript"> + var disqus_config = function () { + this.page.url = '{{ trim .Permalink "/" }}'; + }; + + </script> + </div> + {{ else }} + <div class="disqus-comments"> + {{ template "_internal/disqus.html" . }} + </div> + {{ end }} + {{ end }} + {{ if .Site.Params.staticman }} + <div class="staticman-comments"> + {{ partial "staticman-comments.html" . }} + </div> + {{ end }} + {{ end }} + + </div> + </div> +</div> +{{ end }} diff --git a/themes/beautifulhugo/layouts/_default/terms.html b/themes/beautifulhugo/layouts/_default/terms.html new file mode 100644 index 0000000..d16cf6f --- /dev/null +++ b/themes/beautifulhugo/layouts/_default/terms.html @@ -0,0 +1,38 @@ +{{ define "main" }} + +{{ $data := .Data }} + +<div class="container" role="main"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <article class="post-preview"> + <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> + {{ range $key, $value := .Data.Terms.ByCount }} + <div class="panel panel-default"> + <a class="collapsed" role="button" data-toggle="collapse" data-target="#collapse{{ $value.Name }}" data-parent="#accordion" aria-expanded="false" aria-controls="collapse{{ $value.Name }}"> + <div class="panel-heading" role="tab" id="header{{ $value.Name }}"> + <h4 class="panel-title"> + {{ $value.Name }} + <span class="badge">{{ $value.Count }}</span> + </h4> + </div> + </a> + <div id="collapse{{ $value.Name }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{ $value.Name }}"> + <div class="panel-body"> + <a href="{{ $.Site.LanguagePrefix | absURL }}/{{ $data.Plural }}/{{ $value.Name | urlize }}/" class="list-group-item view-all"> + View all</a> + <div class="list-group"> + {{ range $item := $value.WeightedPages }} + <a href="{{$item.Permalink}}" class="list-group-item">{{ $item.Title }}</a> + {{ end }} + </div> + </div> + </div> + </div> + {{ end }} + </div> + </article> + </div> +</div> + + +{{ end }} diff --git a/themes/beautifulhugo/layouts/index.html b/themes/beautifulhugo/layouts/index.html new file mode 100644 index 0000000..d7544e2 --- /dev/null +++ b/themes/beautifulhugo/layouts/index.html @@ -0,0 +1,65 @@ +{{ define "main" }} + <div role="main" class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + {{ with .Content }} + <div class="well"> + {{.}} + </div> + {{ end }} + + <div class="posts-list"> + {{ $pag := .Paginate (where .Data.Pages "Type" "post") }} + {{ range $pag.Pages }} + <article class="post-preview"> + <a href="{{ .Permalink }}"> + <h2 class="post-title">{{ .Title }}</h2> + {{ if .Params.subtitle }} + <h3 class="post-subtitle"> + {{ .Params.subtitle }} + </h3> + {{ end }} + {{ if .Params.image }} + <img src="{{ .Params.image }}" alt="{{ .Title }}" class="img-title" /> + {{ end }} + </a> + + {{ partial "post_meta.html" . }} + <div class="post-entry"> + {{ if .Truncated }} + {{ if .Params.summary }}{{ .Params.summary }}{{ else }}{{ .Summary }}{{ end }} + <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a> + {{ else }} + {{ .Content }} + {{ end }} + </div> + + {{ if .Params.tags }} + <div class="blog-tags"> + {{ range .Params.tags }} + <a href="{{ $.Site.LanguagePrefix | absURL }}/tags/{{ . | urlize }}/">{{ . }}</a> + {{ end }} + </div> + {{ end }} + </article> + {{ end }} + </div> + + {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} + <ul class="pager main-pager"> + {{ if .Paginator.HasPrev }} + <li class="previous"> + <a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}/">← {{ i18n "newerPosts" }}</a> + </li> + {{ end }} + {{ if .Paginator.HasNext }} + <li class="next"> + <a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}/">{{ i18n "olderPosts" }} →</a> + </li> + {{ end }} + </ul> + {{ end }} + </div> + </div> + </div> +{{ end }} diff --git a/themes/beautifulhugo/layouts/partials/disqus.html b/themes/beautifulhugo/layouts/partials/disqus.html new file mode 100644 index 0000000..8029525 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/disqus.html @@ -0,0 +1,7 @@ +{{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (.Site.Params.comments)) }} + {{ if .Site.DisqusShortname }} + <div class="comments"> + {{ template "_internal/disqus.html" . }} + </div> + {{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/footer.html b/themes/beautifulhugo/layouts/partials/footer.html new file mode 100644 index 0000000..030f657 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/footer.html @@ -0,0 +1,154 @@ +<footer> + <div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <ul class="list-inline text-center footer-links"> + {{ range .Site.Data.beautifulhugo.social.social_icons }} + {{- if isset $.Site.Author .id }} + <li> + <a href="{{ printf .url (index $.Site.Author .id) }}" title="{{ .title }}"> + <span class="fa-stack fa-lg"> + <i class="fas fa-circle fa-stack-2x"></i> + <i class="{{ .icon }} fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{- end -}} + {{ end }} + {{ if .Site.Params.rss }} + <li> + <a href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" title="RSS"> + <span class="fa-stack fa-lg"> + <i class="fas fa-circle fa-stack-2x"></i> + <i class="fas fa-rss fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} + </ul> + <p class="credits copyright text-muted"> + {{ if .Site.Author.name }} + {{ if .Site.Author.website }} + <a href="{{ .Site.Author.website }}">{{ .Site.Author.name }}</a> + {{ else }} + {{ .Site.Author.name }} + {{ end }} + {{ end }} + + • © + {{ if .Site.Params.since }} + {{ .Site.Params.since }} - {{ .Site.LastChange.Format "2006" }} + {{ else }} + {{ .Site.LastChange.Format "2006" }} + {{ end }} + + {{ if .Site.Title }} + • + <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a> + {{ end }} + </p> + <!-- Please don't remove this, keep my open source work credited :) --> + <p class="credits theme-by text-muted"> + {{ i18n "poweredBy" . | safeHTML }} + {{ with .Site.Params.commit }} • [<a href="{{.}}{{ getenv "GIT_COMMIT_SHA" }}">{{ getenv "GIT_COMMIT_SHA_SHORT" }}</a>]{{ end }} + </p> + </div> + </div> + </div> +</footer> + +{{- if .Site.Params.selfHosted -}} +<script src="{{ "js/katex.min.js" | absURL }}"></script> +<script src="{{ "js/auto-render.min.js" | absURL }}"></script> +<script src="{{ "js/jquery.min.js" | absURL }}"></script> +<script src="{{ "js/bootstrap.min.js" | absURL }}"></script> +{{- else -}} +<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.js" integrity="sha384-K3vbOmF2BtaVai+Qk37uypf7VrgBubhQreNQe9aGsz9lB63dIFiQVlJbr92dw2Lx" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/contrib/auto-render.min.js" integrity="sha384-kmZOZB5ObwgQnS/DuDg6TScgOiWWBiVt0plIRkZCmE6rDZGrEOQeHM5PcHi+nyqe" crossorigin="anonymous"></script> +<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> +{{- end }} + +<script src="{{ "js/main.js" | absURL }}"></script> +{{- if .Site.Params.staticman }} +<script src="{{ "js/staticman.js" | absURL }}"></script> +{{- end }} +{{- if .Site.Params.useHLJS }} +<script src="{{ "js/highlight.min.js" | absURL }}"></script> +<script> hljs.initHighlightingOnLoad(); </script> +<script> $(document).ready(function() {$("pre.chroma").css("padding","0");}); </script> +{{- end -}} +<script> renderMathInElement(document.body); </script> + +{{- if .Site.Params.selfHosted -}} +<script src="{{ "js/photoswipe.min.js" | absURL }}"></script> +<script src="{{ "js/photoswipe-ui-default.min.js" | absURL }}"></script> +{{- else -}} +<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.min.js" integrity="sha384-QELNnmcmU8IR9ZAykt67vGr9/rZJdHbiWi64V88fCPaOohUlHCqUD/unNN0BXSqy" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe-ui-default.min.js" integrity="sha384-m67o7SkQ1ALzKZIFh4CiTA8tmadaujiTa9Vu+nqPSwDOqHrDmxLezTdFln8077+q" crossorigin="anonymous"></script> +{{- end -}} +<script src="{{ "js/load-photoswipe.js" | absURL }}"></script> + +<!-- Google Custom Search Engine --> +{{ if .Site.Params.gcse }} +<script> + (function() { + var cx = '{{ .Site.Params.gcse }}'; + var gcse = document.createElement('script'); + gcse.type = 'text/javascript'; + gcse.async = true; + gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(gcse, s); + })(); +</script> +{{ end }} + +{{ if .Site.Params.piwik }} +<!-- Piwik --> +<script type="text/javascript"> + var _paq = _paq || []; + _paq.push(["trackPageView"]); + _paq.push(["enableLinkTracking"]); + + (function() { + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://{{ .Site.Params.piwik.server }}/"; + _paq.push(["setTrackerUrl", u+"piwik.php"]); + _paq.push(["setSiteId", "{{ .Site.Params.piwik.id }}"]); + var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript"; + g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s); + })(); +</script> +<noscript> +<!-- Piwik Image Tracker --> +<img src="http://{{ .Site.Params.piwik.server }}/piwik.php?idsite={{ .Site.Params.piwik.id }}&rec=1" style="border:0" alt="" /> +<!-- End Piwik --> +</noscript> +<!-- End Piwik Code --> +{{ end }} + +{{ if and .Site.Params.delayDisqus .Site.DisqusShortname }} +<!-- Delayed Disqus --> +<script type="text/javascript"> +$(function(){ + $('#show-comments').on('click', function(){ + var disqus_shortname = '{{ .Site.DisqusShortname }}'; + + (function() { + var disqus = document.createElement('script'); + disqus.type = 'text/javascript'; + disqus.async = true; + disqus.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(disqus); + })(); + + $(this).hide(); + }); + }); + +</script> +<script id="dsq-count-scr" src="//{{ .Site.DisqusShortname }}.disqus.com/count.js" async></script> +<!-- End Delayed Disqus --> +{{ end }} + +{{- partial "footer_custom.html" . }} diff --git a/themes/beautifulhugo/layouts/partials/footer_custom.html b/themes/beautifulhugo/layouts/partials/footer_custom.html new file mode 100644 index 0000000..e123130 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/footer_custom.html @@ -0,0 +1,4 @@ +<!-- +If you want to include any custom html just before </body>, put it in /layouts/partials/footer_custom.html +Do not put anything in this file - it's only here so that hugo won't throw an error if /layouts/partials/footer_custom.html doesn't exist. +--> diff --git a/themes/beautifulhugo/layouts/partials/head.html b/themes/beautifulhugo/layouts/partials/head.html new file mode 100644 index 0000000..2c872b4 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/head.html @@ -0,0 +1,111 @@ +{{- if eq .Kind "taxonomyTerm" }} + {{- range $key, $value := .Data.Terms.ByCount }} + {{- $.Scratch.Add "most_used" (slice $value.Name) }} + {{- end }} + {{- if not ($.Scratch.Get "most_used") }} + {{- $description := printf "A full overview of all pages with %s, ordered by %s" .Data.Plural .Data.Singular | truncate 180 }} + {{- $.Scratch.Set "Description" $description }} + {{- else }} + {{- $description := printf "A full overview of all pages with %s, ordered by %s, such as: %s" .Data.Plural .Data.Singular ( delimit ( $.Scratch.Get "most_used" ) ", " ", and " ) | truncate 180 }} + {{- $.Scratch.Set "Description" $description }} + {{- end }} + + {{- $title := printf "Overview of all pages with %s, ordered by %s" .Data.Plural .Data.Singular }} + {{- $.Scratch.Set "Title" $title }} +{{- else if eq .Kind "taxonomy" }} + {{- $description := printf "Overview of all pages with the %s #%s, such as: %s" .Data.Singular $.Title ( index .Pages 0).Title | truncate 160 }} + {{- $.Scratch.Set "Description" $description }} + + {{- $title := printf "Overview of all pages with the %s #%s" .Data.Singular $.Title }} + {{- $.Scratch.Set "Title" $title }} +{{- else }} + {{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary ) }} + {{- $.Scratch.Set "Title" ( .Title | default .Site.Title ) }} +{{- end }} + + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> +<!-- Site Title, Description, Author, and Favicon --> +{{- with ($.Scratch.Get "Title") }} + <title>{{ . }} - {{ $.Site.Title }}</title> + <meta property="og:title" content="{{ . }}" /> + <meta name="twitter:title" content="{{ . | truncate 70 }}" /> +{{- end }} +{{- with ($.Scratch.Get "Description") }} + <meta name="description" content="{{ . }}"> + <meta property="og:description" content="{{ . }}"> + <meta name="twitter:description" content="{{ . | truncate 200 }}"> +{{- end }} +{{- with .Site.Author.name }} + <meta name="author" content="{{ . }}"/> +{{- end }} +{{- partial "seo/main.html" . }} +{{- with .Site.Params.favicon }} + <link href='{{ . | absURL }}' rel='icon' type='image/x-icon'/> +{{- end -}} +<!-- Social Media Tags --> +{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }} + <meta property="og:image" content="{{ . | absURL }}" /> + <meta name="twitter:image" content="{{ . | absURL }}" /> +{{- end }} + <meta name="twitter:card" content="summary" /> +{{- with .Site.Author.twitter }} + <meta name="twitter:site" content="@{{ . }}" /> + <meta name="twitter:creator" content="@{{ . }}" /> +{{- end }} +{{- with .Site.Params.fb_app_id }} + <meta property="fb:app_id" content="{{ . }}" /> +{{- end }} + <meta property="og:url" content="{{ .Permalink | absLangURL }}" /> + <meta property="og:type" content="website" /> + <meta property="og:site_name" content="{{ .Site.Title }}" /> +<!-- Hugo Version number --> + {{ hugo.Generator -}} +<!-- Links and stylesheets --> + <link rel="alternate" href="{{ "index.xml" | absLangURL }}" type="application/rss+xml" title="{{ .Site.Title }}"> + + {{- if .Site.Params.selfHosted -}} + <link rel="stylesheet" href="{{ "css/katex.min.css" | absURL }}" /> + <link rel="stylesheet" href="{{ "fontawesome/css/all.css" | absURL }}" /> + <link rel="stylesheet" href="{{ "css/bootstrap.min.css" | absURL }}" /> + {{- else -}} + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous"> + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> + {{- end -}} + + <link rel="stylesheet" href="{{ "css/main.css" | absURL }}" /> + + {{- if .Site.Params.staticman -}} + <link rel="stylesheet" href="{{ "css/staticman.css" | absURL }}" /> + {{- end -}} + + {{- if .Site.Params.selfHosted -}} + <link rel="stylesheet" href="{{ "css/fonts.css" | absURL }}" /> + {{- else -}} + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" /> + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" /> + {{- end -}} + + {{- if .Site.Params.useHLJS }} + <link rel="stylesheet" href="{{ "css/highlight.min.css" | absURL }}" /> + {{- else -}} + <link rel="stylesheet" href="{{ "css/syntax.css" | absURL }}" /> + {{- end -}} + <link rel="stylesheet" href="{{ "css/codeblock.css" | absURL }}" /> + + {{- if .Site.Params.staticman.recaptcha -}} + <script src='https://www.google.com/recaptcha/api.js'></script> + {{- end -}} + + {{- if .Site.Params.selfHosted -}} + <link rel="stylesheet" href="{{ "css/photoswipe.min.css" | absURL }}" /> + <link rel="stylesheet" href="{{ "css/photoswipe.default-skin.min.css" | absURL }}" /> + {{- else -}} + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.min.css" integrity="sha384-h/L2W9KefUClHWaty3SLE5F/qvc4djlyR4qY3NUV5HGQBBW7stbcfff1+I/vmsHh" crossorigin="anonymous"> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/default-skin/default-skin.min.css" integrity="sha384-iD0dNku6PYSIQLyfTOpB06F2KCZJAKLOThS5HRe8b3ibhdEQ6eKsFf/EeFxdOt5R" crossorigin="anonymous"> + {{- end -}} + +{{- partial "head_custom.html" . }} +{{ template "_internal/google_analytics_async.html" . }} diff --git a/themes/beautifulhugo/layouts/partials/head_custom.html b/themes/beautifulhugo/layouts/partials/head_custom.html new file mode 100644 index 0000000..554494a --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/head_custom.html @@ -0,0 +1,4 @@ +<!-- +If you want to include any custom html just before </head>, put it in /layouts/partials/head_custom.html +Do not put anything in this file - it's only here so that hugo won't throw an error if /layouts/partials/head_custom.html doesn't exist. +--> diff --git a/themes/beautifulhugo/layouts/partials/header.html b/themes/beautifulhugo/layouts/partials/header.html new file mode 100644 index 0000000..2182534 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/header.html @@ -0,0 +1,87 @@ +{{- partial "load-photoswipe-theme.html" . }} + +{{ if .IsHome }} + {{ if .Site.Params.homeTitle }}{{ $.Scratch.Set "title" .Site.Params.homeTitle }}{{ else }}{{ $.Scratch.Set "title" .Site.Title }}{{ end }} + {{ if .Site.Params.subtitle }}{{ $.Scratch.Set "subtitle" .Site.Params.subtitle }}{{ end }} + {{ if .Site.Params.bigimg }}{{ $.Scratch.Set "bigimg" .Site.Params.bigimg }}{{ end }} +{{ else }} + {{ $.Scratch.Set "title" .Title }} + {{ if .Params.subtitle }}{{ $.Scratch.Set "subtitle" .Params.subtitle }}{{ end }} + {{ if .Params.bigimg }}{{ $.Scratch.Set "bigimg" .Params.bigimg }}{{ end }} +{{ end }} +{{ $bigimg := $.Scratch.Get "bigimg" }} +{{ $title := $.Scratch.Get "title" }} +{{ $subtitle := $.Scratch.Get "subtitle" }} + +{{ if or $bigimg $title }} + {{ if $bigimg }} + <div id="header-big-imgs" data-num-img={{len $bigimg}} + {{range $i, $img := $bigimg}} + {{ if (fileExists $img.src)}} + data-img-src-{{add $i 1}}="{{$img.src | absURL }}" + {{else}} + data-img-src-{{add $i 1}}="{{$img.src}}" + {{end}} + {{ if $img.desc}}data-img-desc-{{add $i 1}}="{{$img.desc}}"{{end}} + {{end}}></div> + {{ end }} + + <header class="header-section {{ if $bigimg }}has-img{{ end }}"> + {{ if $bigimg }} + <div class="intro-header big-img"> + {{ $subtitle := $.Scratch.Get "subtitle" }} + <div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <div class="{{ .Type }}-heading"> + <h1>{{ with $.Scratch.Get "title" }}{{.}}{{ else }}<br/>{{ end }}</h1> + {{ if $subtitle }} + {{ if eq .Type "page" }} + <hr class="small"> + <span class="{{ .Type }}-subheading">{{ $subtitle }}</span> + {{ else }} + <h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2> + {{ end }} + {{ end }} + {{ if eq .Type "post" }} + {{ partial "post_meta.html" . }} + {{ end }} + </div> + </div> + </div> + </div> + <span class="img-desc" style="display: inline;"></span> + </div> + {{end}} + <div class="intro-header no-img"> + <div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <div class="{{ .Type }}-heading"> + {{ if eq .Type "list" }} + <h1>{{ if .Data.Singular }}#{{ end }}{{ .Title }}</h1> + {{ else }} + <h1>{{ with $title }}{{.}}{{ else }}<br/>{{ end }}</h1> + {{ end }} + {{ if ne .Type "post" }} + <hr class="small"> + {{ end }} + {{ if $subtitle }} + {{ if eq .Type "page" }} + <span class="{{ .Type }}-subheading">{{ $subtitle }}</span> + {{ else }} + <h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2> + {{ end }} + {{ end }} + {{ if eq .Type "post" }} + {{ partial "post_meta.html" . }} + {{ end }} + </div> + </div> + </div> + </div> + </div> + </header> +{{ else }} + <div class="intro-header"></div> +{{ end }} diff --git a/themes/beautifulhugo/layouts/partials/load-photoswipe-theme.html b/themes/beautifulhugo/layouts/partials/load-photoswipe-theme.html new file mode 100644 index 0000000..fed4012 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/load-photoswipe-theme.html @@ -0,0 +1,51 @@ +<!-- +Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ +--> + +<!-- Root element of PhotoSwipe. Must have class pswp. --> +<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"> +<!-- Background of PhotoSwipe. + It's a separate element, as animating opacity is faster than rgba(). --> +<div class="pswp__bg"></div> +<!-- Slides wrapper with overflow:hidden. --> +<div class="pswp__scroll-wrap"> + <!-- Container that holds slides. + PhotoSwipe keeps only 3 of them in DOM to save memory. + Don't modify these 3 pswp__item elements, data is added later on. --> + <div class="pswp__container"> + <div class="pswp__item"></div> + <div class="pswp__item"></div> + <div class="pswp__item"></div> + </div> + <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. --> + <div class="pswp__ui pswp__ui--hidden"> + <div class="pswp__top-bar"> + <!-- Controls are self-explanatory. Order can be changed. --> + <div class="pswp__counter"></div> + <button class="pswp__button pswp__button--close" title="Close (Esc)"></button> + <button class="pswp__button pswp__button--share" title="Share"></button> + <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button> + <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button> + <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR --> + <!-- element will get class pswp__preloader--active when preloader is running --> + <div class="pswp__preloader"> + <div class="pswp__preloader__icn"> + <div class="pswp__preloader__cut"> + <div class="pswp__preloader__donut"></div> + </div> + </div> + </div> + </div> + <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"> + <div class="pswp__share-tooltip"></div> + </div> + <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"> + </button> + <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"> + </button> + <div class="pswp__caption"> + <div class="pswp__caption__center"></div> + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/nav.html b/themes/beautifulhugo/layouts/partials/nav.html new file mode 100644 index 0000000..d0598dc --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/nav.html @@ -0,0 +1,96 @@ +<nav class="navbar navbar-default navbar-fixed-top navbar-custom"> + <div class="container-fluid"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar"> + <span class="sr-only">{{ i18n "toggleNavigation" }}</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="{{ "" | absLangURL }}">{{ .Site.Title }}</a> + </div> + + <div class="collapse navbar-collapse" id="main-navbar"> + <ul class="nav navbar-nav navbar-right"> + {{ range .Site.Menus.main.ByWeight }} + {{ if .HasChildren }} + <li class="navlinks-container"> + <a class="navlinks-parent">{{ .Name }}</a> + <div class="navlinks-children"> + {{ range .Children }} + <a href="{{ .URL | relLangURL }}">{{ .Name }}</a> + {{ end }} + </div> + </li> + {{ else }} + <li> + <a title="{{ .Name }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a> + </li> + {{ end }} + {{ end }} + + {{ if .Site.IsMultiLingual }} + {{ if ge (len .Site.Languages) 3 }} + <li class="navlinks-container"> + <a class="navlinks-parent">{{ i18n "languageSwitcherLabel" }}</a> + <div class="navlinks-children"> + {{ range .Site.Languages }} + {{ if not (eq .Lang $.Site.Language.Lang) }} + <a href="/{{ .Lang }}" lang="{{ .Lang }}">{{ default .Lang .LanguageName }}</a> + {{ end }} + {{ end }} + </div> + </li> + {{ else }} + <li> + {{ range .Site.Languages }} + {{ if not (eq .Lang $.Site.Language.Lang) }} + <a href="/{{ .Lang }}" lang="{{ .Lang }}">{{ default .Lang .LanguageName }}</a> + {{ end }} + {{ end }} + </li> + {{ end }} + {{ end }} + + {{ if isset .Site.Params "gcse" }} + <li> + <a href="#modalSearch" data-toggle="modal" data-target="#modalSearch" style="outline: none;"> + <span class="hidden-sm hidden-md hidden-lg">{{ i18n "gcseLabelShort" }}</span> <span id="searchGlyph" class="glyphicon glyphicon-search"></span> + </a> + </li> + {{ end }} + </ul> + </div> + + {{ if isset .Site.Params "logo" }} + <div class="avatar-container"> + <div class="avatar-img-border"> + <a title="{{ .Site.Title }}" href="{{ "" | absLangURL }}"> + <img class="avatar-img" src="{{ .Site.Params.logo | absURL }}" alt="{{ .Site.Title }}" /> + </a> + </div> + </div> + {{ end }} + + </div> +</nav> + +<!-- Search Modal --> +{{ if isset .Site.Params "gcse" }} + <div id="modalSearch" class="modal fade" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">{{ i18n "gcseLabelLong" . }}</h4> + </div> + <div class="modal-body"> + <gcse:search></gcse:search> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{ i18n "gcseClose" }}</button> + </div> + </div> + </div> + </div> +{{ end }} diff --git a/themes/beautifulhugo/layouts/partials/post_meta.html b/themes/beautifulhugo/layouts/partials/post_meta.html new file mode 100644 index 0000000..f7e03d7 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/post_meta.html @@ -0,0 +1,43 @@ +<span class="post-meta"> + {{ $lastmodstr := default (i18n "dateFormat") .Site.Params.dateformat | .Lastmod.Format }} + {{ $datestr := default (i18n "dateFormat") .Site.Params.dateformat | .Date.Format }} + <i class="fas fa-calendar"></i> {{ $datestr | i18n "postedOnDate"}} + {{ if ne $datestr $lastmodstr }} + {{ $lastmodstr | i18n "lastModified" }} + {{ end }} + {{ if .Site.Params.readingTime }} + | <i class="fas fa-clock"></i> {{ i18n "readingTime"}}{{ .ReadingTime }} {{ i18n "readTime" }} + {{ end }} + {{ if .Site.Params.wordCount }} + | <i class="fas fa-book"></i> {{ .WordCount }} {{ i18n "words" }} + {{ end }} + {{ if .Params.author }} + | <i class="fas fa-user"></i> {{ .Params.author | safeHTML }} + {{ else }} + | <i class="fas fa-user"></i> {{ .Site.Author.name | safeHTML }} + {{ end }} + {{- if .Site.Params.staticman -}} + | <i class="fas fa-comment"></i> + {{ $slug := replace .RelPermalink "/" "" }} + {{ if .Site.Data.comments }} + {{ $comments := index $.Site.Data.comments $slug }} + {{ if $comments }} + {{ if gt (len $comments) 1 }} + {{ len $comments }} {{ i18n "moreComment" }} + {{ else }} + {{ len $comments }} {{ i18n "oneComment" }} + {{ end }} + {{ else }} + 0 {{ i18n "oneComment" }} + {{ end }} + {{ end }} + {{ end }} + {{ if .IsTranslated -}} + {{- $sortedTranslations := sort .Translations "Site.Language.Weight" -}} + {{- $links := apply $sortedTranslations "partial" "translation_link.html" "." -}} + {{- $cleanLinks := apply $links "chomp" "." -}} + {{- $linksOutput := delimit $cleanLinks (i18n "translationsSeparator") -}} + • {{ i18n "translationsLabel" }}{{ $linksOutput }} + {{- end }} +</span> + diff --git a/themes/beautifulhugo/layouts/partials/seo/main.html b/themes/beautifulhugo/layouts/partials/seo/main.html new file mode 100644 index 0000000..a0f7ff7 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/main.html @@ -0,0 +1,3 @@ +{{- partial "seo/schema" . }} +{{- partial "seo/opengraph" . }} +{{- partial "seo/twitter" . }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/opengraph.html b/themes/beautifulhugo/layouts/partials/seo/opengraph.html new file mode 100644 index 0000000..9a14a07 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/opengraph.html @@ -0,0 +1,15 @@ +{{- with .Title | default .Site.Title }} +<meta property="og:title" content="{{ . }}" /> +{{- end }} +{{- with .Description | default .Params.subtitle | default .Summary }} +<meta property="og:description" content="{{ . }}"> +{{- end }} +{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }} +<meta property="og:image" content="{{ . | absURL }}" /> +{{- end }} +{{- with .Site.Params.fb_app_id }} +<meta property="fb:app_id" content="{{ . }}" /> +{{- end }} +<meta property="og:url" content="{{ .Permalink | absLangURL }}" /> +<meta property="og:type" content="website" /> +<meta property="og:site_name" content="{{ .Site.Title }}" /> diff --git a/themes/beautifulhugo/layouts/partials/seo/schema.html b/themes/beautifulhugo/layouts/partials/seo/schema.html new file mode 100644 index 0000000..f201796 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/schema.html @@ -0,0 +1,6 @@ +{{- partial "seo/structured/website" . }} +{{- partial "seo/structured/organization" . }} +{{ if .IsPage }} +{{- partial "seo/structured/breadcrumb" . }} +{{- partial "seo/structured/article" . }} +{{ end }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/article.html b/themes/beautifulhugo/layouts/partials/seo/structured/article.html new file mode 100644 index 0000000..b828456 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/article.html @@ -0,0 +1,28 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Article", + "author": { + "name" : "{{ if .Params.author -}}{{ .Params.author }}{{- else if .Site.Author.name -}}{{ .Site.Author.name }}{{- end }}" + }, + "headline": "{{ .Title }}", + "description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}", + "inLanguage" : "{{ .Lang }}", + "wordCount": {{ .WordCount }}, + "datePublished" : "{{ .PublishDate.Format "2006-01-02T15:04:05" }}", + "dateModified" : "{{ .Date.Format "2006-01-02T15:04:05" }}", + "image" : "{{ .Site.Params.logo | absURL }}", + "keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ], + "mainEntityOfPage" : "{{ .Permalink }}", + "publisher" : { + "@type": "Organization", + "name" : "{{ .Site.BaseURL }}", + "logo" : { + "@type" : "ImageObject", + "url" : "{{ .Site.Params.logo | absURL }}", + "height" : 60 , + "width" : 60 + } + } +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/breadcrumb.html b/themes/beautifulhugo/layouts/partials/seo/structured/breadcrumb.html new file mode 100644 index 0000000..81ac41b --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/breadcrumb.html @@ -0,0 +1,21 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "BreadcrumbList", + "itemListElement": [{ + "@type": "ListItem", + "position": 1, + "item": { + "@id": "{{ .Site.BaseURL }}", + "name": "home" + } + },{ + "@type": "ListItem", + "position": 3, + "item": { + "@id": "{{ .Permalink }}", + "name": "{{ .Title | humanize }}" + } + }] +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/organization.html b/themes/beautifulhugo/layouts/partials/seo/structured/organization.html new file mode 100644 index 0000000..117bccd --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/organization.html @@ -0,0 +1,12 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Organization", + "name": "{{ .Site.Params.organizationName }}", + "url": "{{ .Site.BaseURL }}" + {{ with .Site.Params.socialProfiles }}, "sameAs": {{ . }}{{ end }} + {{ with .Site.Params.organizationLogo }}, "logo": "{{ . }}"{{ end }} + {{ with .Site.Params.organizationAddress }}, "address": "{{ . }}"{{ end }} + {{ with .Site.Data.organization.contacts.contactPoint }}, "contactPoint": {{ . }}{{ end }} +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/post.html b/themes/beautifulhugo/layouts/partials/seo/structured/post.html new file mode 100644 index 0000000..f1a10da --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/post.html @@ -0,0 +1,47 @@ +<script type="application/ld+json"> { + "@context" : "http://schema.org", + "@type" : "BlogPosting", + {{ if .Params.categories }}{{ range .Params.categories }}"articleSection" : "{{ . }}",{{ end }}{{ end }} + "name" : "{{ .Title | safeJS }}", + "headline" : "{{ .Title | safeJS }}", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "{{ .Permalink }}" + }, + "description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}", + "inLanguage" : "{{ .Lang }}", + {{ if .Params.author -}} + "author": { + "@type": "Person", + "name": "{{ .Params.author }}" + }, + {{- else if .Site.Author.name -}} + "author": { + "@type": "Person", + "name": "{{ .Site.Author.name }}" + }, + {{- end }} + "copyrightYear" : "{{ .Site.Params.since }} - {{ .Site.LastChange.Format "2006" }}", + {{ 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 }} + "url" : "{{ .Permalink }}", + "wordCount" : "{{ .WordCount }}", + "image" : "{{ .Site.Params.logo | absURL }}", + "keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ], + "publisher" : { + "@type": "Organization", + "name" : "{{ .Site.BaseURL }}", + "logo" : { + "@type" : "ImageObject", + "url" : "{{ .Site.Params.logo | absURL }}", + "height" : 60 , + "width" : 60 + } + } +} </script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/website.html b/themes/beautifulhugo/layouts/partials/seo/structured/website.html new file mode 100644 index 0000000..107e7fb --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/website.html @@ -0,0 +1,9 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "WebSite", + "name": "{{ .Site.Title }}", + {{ with .Site.Params.alternatePageName }}"alternateName": "{{ . }}",{{ end }} + "url": "{{ .Site.BaseURL }}" +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/twitter.html b/themes/beautifulhugo/layouts/partials/seo/twitter.html new file mode 100644 index 0000000..0eb1e9b --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/twitter.html @@ -0,0 +1,14 @@ +{{- with .Title | default .Site.Title }} + <meta name="twitter:title" content="{{ . | truncate 70 }}" /> +{{- end }} +{{- with .Description | default .Params.subtitle | default .Summary }} + <meta name="twitter:description" content="{{ . | truncate 200 }}"> +{{- end }} +{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }} + <meta name="twitter:image" content="{{ . | absURL }}" /> +{{- end }} + <meta name="twitter:card" content="summary" /> +{{- with .Site.Author.twitter }} + <meta name="twitter:site" content="@{{ . }}" /> + <meta name="twitter:creator" content="@{{ . }}" /> +{{- end }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/share-links.html b/themes/beautifulhugo/layouts/partials/share-links.html new file mode 100644 index 0000000..d264d1c --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/share-links.html @@ -0,0 +1,55 @@ +{{ if or .Params.socialShare (and .Site.Params.socialShare (ne .Params.socialShare false)) }} +<!-- Social Share Button HTML --> +<div class="share-box" aria-hidden="true"> + <ul class="share"> + <!-- Twitter --> + <li> + <a href="//twitter.com/share?url={{ .Permalink }}&text={{ .Title }}&via={{ .Site.Author.twitter }}" target="_blank" title="Share on Twitter"> + <i class="fab fa-twitter"></i> + </a> + </li> + + <!-- Google Plus --> + <li> + <a href="//plus.google.com/share?url={{ .Permalink }}" target="_blank" title="Share on Google Plus"> + <i class="fab fa-google-plus"></i> + </a> + </li> + + <!-- Facebook --> + <li> + <a href="//www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook"> + <i class="fab fa-facebook"></i> + </a> + </li> + + <!-- Reddit --> + <li> + <a href="//reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" target="_blank" title="Share on Reddit"> + <i class="fab fa-reddit"></i> + </a> + </li> + + <!-- LinkedIn --> + <li> + <a href="//www.linkedin.com/shareArticle?url={{ .Permalink }}&title={{ .Title }}" target="_blank" title="Share on LinkedIn"> + <i class="fab fa-linkedin"></i> + </a> + </li> + + <!-- StumbleUpon --> + <li> + <a href="//www.stumbleupon.com/submit?url={{ .Permalink }}&title={{ .Title }}" target="_blank" title="Share on StumbleUpon"> + <i class="fab fa-stumbleupon"></i> + </a> + </li> + + <!-- Pinterest --> + <li> + <a href="//www.pinterest.com/pin/create/button/?url={{ .Permalink }}&description={{ .Title }}" target="_blank" title="Share on Pinterest"> + <i class="fab fa-pinterest"></i> + </a> + </li> + </ul> + </div> + {{ end }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/staticman-comments.html b/themes/beautifulhugo/layouts/partials/staticman-comments.html new file mode 100644 index 0000000..8d01894 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/staticman-comments.html @@ -0,0 +1,93 @@ +<section class="js-comments staticman-comments"> + + {{ $slug := replace .RelPermalink "/" "" }} + + {{ if .Site.Data.comments }} + {{ $comments := index $.Site.Data.comments $slug }} + {{ if $comments }} + {{ if gt (len $comments) 1 }} + <h3>{{ len $comments }} {{ i18n "moreComment" }}</h3> + {{ else }} + <h3>{{ len $comments }} {{ i18n "oneComment" }}</h3> + {{ end }} + {{ else }} + <h3>{{ i18n "noComment" }}</h3> + {{ end }} + + + {{ $.Scratch.Set "hasComments" 0 }} + {{ range $index, $comments := (index $.Site.Data.comments $slug ) }} + {{ if not .parent }} + {{ $.Scratch.Add "hasComments" 1 }} + <article id="comment-{{ $.Scratch.Get "hasComments" }}" class="static-comment"> + <img class="comment-avatar" src="https://www.gravatar.com/avatar/{{ .email }}?s=48"> + {{ if .website }} + <h4 class="comment-author"><a rel="external nofollow" href="{{ .website }}">{{ .name }}</a></h4> + {{ else }} + <h4 class="comment-author">{{ .name }}</h4> + {{ end }} + <div class="comment-timestamp"><a href="#comment-{{ $.Scratch.Get "hasComments" }}" title="Permalink to this comment"><time datetime="{{ .date }}">{{ dateFormat (default (i18n "shortdateFormat") .Site.Params.dateformat) .date}}</time></a></div> + <div class="comment-content"><p>{{ .comment | markdownify }}</p></div> + </article> + {{ end }} + {{ end }} + {{ end }} + + + +<form class="js-form form" method="post" action="{{ .Site.Params.staticman.api }}"> + <input type="hidden" name="options[slug]" value="{{ replace .RelPermalink "/" "" }}"> + <input type="hidden" name="options[parent]" value=""> + + {{ if .Site.Params.staticman.recaptcha }} + <input type="hidden" name="options[reCaptcha][siteKey]" value="{{ .Site.Params.staticman.recaptcha.sitekey }}"> + <input type="hidden" name="options[reCaptcha][secret]" value="{{ .Site.Params.staticman.recaptcha.secret }}"> + {{ end }} + + <fieldset> + <div class="textfield"> + <textarea name="fields[comment]" type="text" placeholder="{{ i18n "useMarkdown" }}"></textarea> + </div> + </fieldset> + + <fieldset> + <div class="textfield"> + <input name="fields[name]" type="text" placeholder="{{ i18n "yourName" }}"/> + </div> + </fieldset> + + <fieldset> + <div class="textfield"> + <input type="email" name="fields[email]" placeholder="{{ i18n "yourEmail" }}"/> + </div> + </fieldset> + + <fieldset> + <div class="textfield"> + <input type="text" name="fields[website]" placeholder="{{ i18n "yourWebsite" }}"/> + </div> + </fieldset> + + {{ if .Site.Params.staticman.recaptcha }} + <fieldset> + <div class="g-recaptcha" data-sitekey="{{ .Site.Params.staticman.recaptcha.sitekey }}"></div> + </fieldset> + {{ end }} + + <fieldset> + <button class="button"> + Submit + </button> + </fieldset> +</form> +</section> + +<article class="modal"> + <div class="title"> + <h2 class="js-modal-title"></h2> + </div> + <div class="js-modal-text"></div> + <div> + <button class="js-close-modal">Close</button> + </div> +</article> diff --git a/themes/beautifulhugo/layouts/partials/translation_link.html b/themes/beautifulhugo/layouts/partials/translation_link.html new file mode 100644 index 0000000..1f9a817 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/translation_link.html @@ -0,0 +1,2 @@ +<a href="{{ .Permalink }}" lang="{{ .Lang }}">{{ default .Lang .Site.Language.LanguageName }}</a> + diff --git a/themes/beautifulhugo/layouts/shortcodes/column.html b/themes/beautifulhugo/layouts/shortcodes/column.html new file mode 100644 index 0000000..5e07dfb --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/column.html @@ -0,0 +1 @@ +</div><div class="right"> diff --git a/themes/beautifulhugo/layouts/shortcodes/columns.html b/themes/beautifulhugo/layouts/shortcodes/columns.html new file mode 100644 index 0000000..fd457bc --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/columns.html @@ -0,0 +1 @@ +<div class="splitbox"><div class="left"> diff --git a/themes/beautifulhugo/layouts/shortcodes/details.html b/themes/beautifulhugo/layouts/shortcodes/details.html new file mode 100644 index 0000000..3410075 --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/details.html @@ -0,0 +1,3 @@ +<details><summary>{{ .Get 0 }}</summary> +{{ .Inner }} +</details> diff --git a/themes/beautifulhugo/layouts/shortcodes/endcolumns.html b/themes/beautifulhugo/layouts/shortcodes/endcolumns.html new file mode 100644 index 0000000..13c2f9f --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/endcolumns.html @@ -0,0 +1 @@ +</div><div style="clear:both"></div></div> diff --git a/themes/beautifulhugo/layouts/shortcodes/figure.html b/themes/beautifulhugo/layouts/shortcodes/figure.html new file mode 100644 index 0000000..edf542a --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/figure.html @@ -0,0 +1,29 @@ +<!-- +Put this file in /layouts/shortcodes/figure.html +NB this overrides Hugo's built-in "figure" shortcode but is backwards compatible +Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ +--> +<!-- count how many times we've called this shortcode; load the css if it's the first time --> +{{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href="/css/hugo-easy-gallery.css" />{{ end }} +{{- $.Page.Scratch.Add "figurecount" 1 -}} +<!-- use either src or link-thumb for thumbnail image --> +{{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }} +<div class="box{{ with .Get "caption-position" }} fancy-figure caption-position-{{.}}{{end}}{{ with .Get "caption-effect" }} caption-effect-{{.}}{{end}}" {{ with .Get "width" }}style="max-width:{{.}}"{{end}}> + <figure {{ with .Get "class" }}class="{{.}}"{{ end }} itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> + <div class="img"{{ if .Parent }} style="background-image: url('{{ print .Site.BaseURL $thumb }}');"{{ end }}{{ with .Get "size" }} data-size="{{.}}"{{ end }}> + <img itemprop="thumbnail" src="{{ $thumb }}" {{ with .Get "alt" | default (.Get "caption") | default $thumb }}alt="{{.}}"{{ end }}/><!-- <img> hidden if in .gallery --> + </div> + {{ with .Get "link" | default (.Get "src") }}<a href="{{.}}" itemprop="contentUrl"></a>{{ end }} + {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} + <figcaption> + {{- with .Get "title" }}<h4>{{.}}</h4>{{ end }} + {{- if or (.Get "caption") (.Get "attr")}} + <p> + {{- .Get "caption" -}} + {{- with .Get "attrlink"}}<a href="{{.}}">{{ .Get "attr" }}</a>{{ else }}{{ .Get "attr"}}{{ end -}} + </p> + {{- end }} + </figcaption> + {{- end }} + </figure> +</div> diff --git a/themes/beautifulhugo/layouts/shortcodes/gallery.html b/themes/beautifulhugo/layouts/shortcodes/gallery.html new file mode 100644 index 0000000..aac2ace --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/gallery.html @@ -0,0 +1,41 @@ +<!-- +Put this file in /layouts/shortcodes/gallery.html +Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ +--> +<!-- count how many times we've called this shortcode; load the css if it's the first time --> +{{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href="/css/hugo-easy-gallery.css" />{{ end }} +{{- $.Page.Scratch.Add "figurecount" 1 }} +{{ $baseURL := .Site.BaseURL }} +<div class="gallery caption-position-{{ with .Get "caption-position" | default "bottom" }}{{.}}{{end}} caption-effect-{{ with .Get "caption-effect" | default "slide" }}{{.}}{{end}} hover-effect-{{ with .Get "hover-effect" | default "zoom" }}{{.}}{{end}} {{ if ne (.Get "hover-transition") "none" }}hover-transition{{end}}" itemscope itemtype="http://schema.org/ImageGallery"> + {{- with (.Get "dir") -}} + <!-- If a directory was specified, generate figures for all of the images in the directory --> + {{- $files := readDir (print "/static/" .) }} + {{- range $files -}} + <!-- skip files that aren't images, or that inlcude the thumb suffix in their name --> + {{- $thumbext := $.Get "thumb" | default "-thumb" }} + {{- $isthumb := .Name | findRE ($thumbext | printf "%s\\.") }}<!-- is the current file a thumbnail image? --> + {{- $isimg := lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp)" }}<!-- is the current file an image? --> + {{- if and $isimg (not $isthumb) }} + {{- $caption := .Name | replaceRE "\\..*" "" | humanize }}<!-- humanized filename without extension --> + {{- $linkURL := print $baseURL ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image --> + {{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}<!-- filename of thumbnail image --> + {{- $thumbexists := where $files "Name" $thumb }}<!-- does a thumbnail image exist? --> + {{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}<!-- absolute URL to thumbnail image --> + <div class="box"> + <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> + <div class="img" style="background-image: url('{{ if $thumbexists }}{{ $thumbURL }}{{ else }}{{ $linkURL }}{{ end }}');" > + <img itemprop="thumbnail" src="{{ if $thumbexists }}{{ $thumbURL }}{{ else }}{{ $linkURL }}{{ end }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery --> + </div> + <figcaption> + <p>{{ $caption }}</p> + </figcaption> + <a href="{{ $linkURL }}" itemprop="contentUrl"></a><!-- put <a> last so it is stacked on top --> + </figure> + </div> + {{- end }} + {{- end }} + {{- else -}} + <!-- If no directory was specified, include any figure shortcodes called within the gallery --> + {{ .Inner }} + {{- end }} +</div> diff --git a/themes/beautifulhugo/layouts/shortcodes/mermaid.html b/themes/beautifulhugo/layouts/shortcodes/mermaid.html new file mode 100644 index 0000000..6832cf1 --- /dev/null +++ b/themes/beautifulhugo/layouts/shortcodes/mermaid.html @@ -0,0 +1,7 @@ +<link href="{{"css/mermaid.css" | relURL}}" type="text/css" rel="stylesheet"/> +<script defer src="{{"js/mermaid.js" | relURL}}"> + mermaid.initialize({startOnLoad:true}); +</script> +<div class="mermaid" align="{{ if .Get "align" }}{{ .Get "align" }}{{ else }}center{{ end }}" > + {{ safeHTML .Inner }} +</div> |