mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Regis Philibert
02.02.2021 120ebe58be756e2913a3c60de924c375ed950ffe
Merge branch 'master' into 422-improve-socials
1 files added
29 files modified
262 ■■■■ changed files
README.md 12 ●●●●● patch | view | raw | blame | history
archetypes/default.md 2 ●●● patch | view | raw | blame | history
exampleSite/config.toml 3 ●●●● patch | view | raw | blame | history
i18n/bg.toml 5 ●●●● patch | view | raw | blame | history
i18n/de.toml 13 ●●●●● patch | view | raw | blame | history
i18n/en.toml 13 ●●●●● patch | view | raw | blame | history
i18n/es.toml 5 ●●●● patch | view | raw | blame | history
i18n/fr.toml 13 ●●●●● patch | view | raw | blame | history
i18n/hu.toml 5 ●●●● patch | view | raw | blame | history
i18n/it.toml 5 ●●●● patch | view | raw | blame | history
i18n/nl.toml 5 ●●●● patch | view | raw | blame | history
i18n/no.toml 5 ●●●● patch | view | raw | blame | history
i18n/pt.toml 3 ●●●●● patch | view | raw | blame | history
i18n/ru.toml 3 ●●●●● patch | view | raw | blame | history
i18n/sv.toml 5 ●●●● patch | view | raw | blame | history
i18n/tr.toml 3 ●●●●● patch | view | raw | blame | history
i18n/uk.toml 5 ●●●● patch | view | raw | blame | history
i18n/zh-tw.toml 5 ●●●● patch | view | raw | blame | history
i18n/zh.toml 5 ●●●● patch | view | raw | blame | history
layouts/_default/single.html 10 ●●●●● patch | view | raw | blame | history
layouts/index.html 4 ●●●● patch | view | raw | blame | history
layouts/partials/func/GetFeaturedImage.html 10 ●●●● patch | view | raw | blame | history
layouts/partials/func/style/GetMainCSS.html 2 ●●● patch | view | raw | blame | history
layouts/partials/site-navigation.html 2 ●●● patch | view | raw | blame | history
layouts/partials/social-follow.html 99 ●●●● patch | view | raw | blame | history
layouts/partials/summary-with-image.html 6 ●●●● patch | view | raw | blame | history
layouts/partials/summary.html 2 ●●● patch | view | raw | blame | history
layouts/partials/svg/tiktok.svg 6 ●●●●● patch | view | raw | blame | history
layouts/post/summary-with-image.html 2 ●●● patch | view | raw | blame | history
layouts/post/summary.html 4 ●●●● patch | view | raw | blame | history
README.md
@@ -252,6 +252,18 @@
```
### Localize date format
Dates of blog posts and single pages are rendered with the default date format commonly used in the USA and Canada. It is possible to specify a different format.
```
[params]
  date_format = "2. January 2006"
```
See hugo's documentation of the [`dateFormat` function](https://gohugo.io/functions/dateformat/) for more details.
### Nearly finished
In order to see your site in action, run Hugo's built-in local server.
archetypes/default.md
@@ -1,5 +1,5 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
title: "{{ replace .File.ContentBaseName "-" " " | title }}"
date: {{ .Date }}
tags: []
featured_image: ""
exampleSite/config.toml
@@ -27,6 +27,7 @@
  filename = "sitemap.xml"
[params]
  author = ""
  favicon = ""
  site_logo = ""
  description = "The last theme you'll ever need. Maybe."
@@ -37,4 +38,4 @@
[[params.ananke_socials]]
name = "twitter"
url = "https://twitter.com/GoHugoIO"
url = "https://twitter.com/GoHugoIO"
i18n/bg.toml
@@ -32,4 +32,7 @@
other = "Изпрати"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} страница"
i18n/de.toml
@@ -32,4 +32,15 @@
other = "Senden"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[readingTime]
one = "Eine Minute"
other = "{{ .Count }} Minuten"
[wordCount]
one = "Ein Wort"
other = "{{ .Count }} Wörter"
[pageTitle]
other = "{{ .Name }} Seite"
i18n/en.toml
@@ -32,4 +32,15 @@
other = "Send"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[readingTime]
one = "One minute read"
other = "{{ .Count }} minutes read"
[wordCount]
one = "One word"
other = "{{ .Count }} words"
[pageTitle]
other = "{{ .Name }} page"
i18n/es.toml
@@ -32,4 +32,7 @@
other = "Enviar"
[taxonomyPageList]
other = "A continuación encontrará las páginas asociadas a “{{ .Title }}”"
other = "A continuación encontrará las páginas asociadas a “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} pagina"
i18n/fr.toml
@@ -32,4 +32,15 @@
other = "Envoyer"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[readingTime]
one = "Une minute de lecture"
other = "{{ .Count }} minutes de lecture"
[wordCount]
one = "Un mot"
other = "{{ .Count }} mots"
[pageTitle]
other = "{{ .Name }} page"
i18n/hu.toml
@@ -32,4 +32,7 @@
other = "Küldés"
[taxonomyPageList]
other = "Ezen a lapon a(z) {{ .Title }} kategóriába tartozó cikkeket találod"
other = "Ezen a lapon a(z) {{ .Title }} kategóriába tartozó cikkeket találod"
[pageTitle]
other = "{{ .Name }} oldal"
i18n/it.toml
@@ -32,4 +32,7 @@
other = "Invia"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} pagina"
i18n/nl.toml
@@ -32,4 +32,7 @@
other = "Stuur"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} pagina"
i18n/no.toml
@@ -32,4 +32,7 @@
other = "Sende"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} side"
i18n/pt.toml
@@ -33,3 +33,6 @@
[taxonomyPageList]
other = "Abaixo você encontrará as páginas que utilizam o termo de taxonomia “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} página"
i18n/ru.toml
@@ -33,3 +33,6 @@
[taxonomyPageList]
other = "Ниже вы найдете страницы, на которых используется термин таксономии “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} страница"
i18n/sv.toml
@@ -32,4 +32,7 @@
other = "Skicka"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} sida"
i18n/tr.toml
@@ -33,3 +33,6 @@
[taxonomyPageList]
other = "Aşağıda, “{{ .Title }}” sınıflandırma terimini kullanan sayfaları bulacaksınız."
[pageTitle]
other = "{{ .Name }} sayfa"
i18n/uk.toml
@@ -32,4 +32,7 @@
other = "Надіслати"
[taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"
[pageTitle]
other = "{{ .Name }} сторінки"
i18n/zh-tw.toml
@@ -32,4 +32,7 @@
other = "送出"
[taxonomyPageList]
other = "標籤為 “{{ .Title }}” 的頁面如下"
other = "標籤為 “{{ .Title }}” 的頁面如下"
[pageTitle]
other = "{{ .Name }} 頁"
i18n/zh.toml
@@ -32,4 +32,7 @@
other = "发送"
[taxonomyPageList]
other = "标签为“{{ .Title }}”的页面如下"
other = "标签为“{{ .Title }}”的页面如下"
[pageTitle]
other = "{{ .Name }} 页"
layouts/_default/single.html
@@ -18,7 +18,7 @@
      <h1 class="f1 athelas mt3 mb1">
        {{- .Title -}}
      </h1>
      {{ with .Params.author }}
      {{ with .Params.author | default .Site.Params.author }}
      <p class="tracked">
          By <strong>
          {{ if reflect.IsSlice . }}
@@ -30,9 +30,11 @@
      </p>
      {{ end }}
      {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
      {{ if not .Date.IsZero }}
      <time class="f6 mv4 dib tracked" {{ printf `datetime="%s"` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}>
        {{- .Date.Format "January 2, 2006" -}}
        {{- .Date.Format (default "January 2, 2006" .Site.Params.date_format) -}}
      </time>
      {{end}}
      {{/*
          Show "reading time" and "word count" but only if one of the following are true:
@@ -41,8 +43,8 @@
          3) A page front matter value is set `show_reading_time = true`
        */}}
      {{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}}
        <span class="f6 mv4 dib tracked"> - {{ .ReadingTime}} minutes read</span>
        <span class="f6 mv4 dib tracked"> - {{ .WordCount}} words</span>
        <span class="f6 mv4 dib tracked"> - {{ i18n "readingTime" .ReadingTime }} </span>
        <span class="f6 mv4 dib tracked"> - {{ i18n "wordCount" .WordCount }} </span>
      {{ end }}
    </header>
    <div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes"  | default "serif"}} f4 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
layouts/index.html
@@ -38,7 +38,7 @@
        {{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
        {{ range (first 4 (after $n_posts $section))  }}
          <h2 class="f5 fw4 mb4 dib mr3">
            <a href="{{ .Permalink }}" class="link black dim">
            <a href="{{ .RelPermalink }}" class="link black dim">
              {{ .Title }}
            </a>
          </h2>
@@ -46,7 +46,7 @@
        {{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
        {{ with .Site.GetPage "section" $section_name }}
          <a href="{{ .Permalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
          <a href="{{ .RelPermalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
        {{ end }}
        </section>
      {{ end }}
layouts/partials/func/GetFeaturedImage.html
@@ -1,8 +1,8 @@
{{/* 
    GetFeaturedImage
    This partial gets the url for featured image for a given page.
    This partial gets the url for featured image for a given page.
    If a featured_image was set in the page's front matter, then that will be used.
    If not set, this will search page resources to find an image that contains the word
@@ -11,7 +11,7 @@
    If no featured_image was set, and there's no "cover" image in page resources, then
    this partial returns an empty string (which evaluates to false).
    @return Permalink to featured image, or an empty string if not found.
    @return RelPermalink to featured image, or an empty string if not found.
*/}}
@@ -26,10 +26,10 @@
{{ else }}
    {{ $img := (.Resources.ByType "image").GetMatch "*cover*" }}
    {{ with $img }}
        {{ $linkToCover = .Permalink }}
        {{ $linkToCover = .RelPermalink }}
    {{ end }}
{{ end }}
{{/* return either a permalink, or an empty string. Note that partials can only have a single
return statement, so this needs to be at the end of the partial (and not in the if block) */}}
{{ return $linkToCover }}
{{ return $linkToCover }}
layouts/partials/func/style/GetMainCSS.html
@@ -60,7 +60,7 @@
  {{ $style = $style | resources.ToCSS $options | minify }}
  {{/* We fingerprint in production for cache busting purposes */}}
  {{ if eq (getenv "HUGO_ENV") "production" }}
    {{ $style = . | fingerprint }}
    {{ $style = $style | fingerprint }}
  {{ end }}
  {{/* We're ready to set returning variable with resulting resource */}}
  {{ $main_style = $style }}
layouts/partials/site-navigation.html
@@ -13,7 +13,7 @@
        <ul class="pl0 mr3">
          {{ range .Site.Menus.main }}
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ .Name }} page">
            <a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ i18n "pageTitle" . }}">
              {{ .Name }}
            </a>
          </li>
layouts/partials/social-follow.html
@@ -1,13 +1,86 @@
{{ $socials := partialCached "func/socials/Get" "socials/Get" }}
<div class="ananke-socials">
  {{ range $socials }}
    <a href="{{ .url }}" target="_blank" class="{{ .name }} ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l mr1" title="{{ .label }} link" rel="noopener" aria-label="follow on {{ .label }}——Opens in a new window">
      {{ with .icon }}
        <span class="icon">{{ . }}</span>
      {{ else }}
        {{ .label }}
      {{ end }}
      {{- partial "new-window-icon.html" . -}}
    </a>
  {{ end }}
</div>
<!-- TODO: Add follow intents where available TODO: Revisit color and hover color -->
{{ $icon_size := "32px" }}
{{ with .Param "stackoverflow" }}
<a href="{{ . }}" target="_blank" class="link-transition stackoverflow link dib z-999 pt3 pt0-l mr1" title="Stack Overflow link" rel="noopener" aria-label="follow on Stack Overflow——Opens in a new window">
  {{ partial "svg/stackoverflow.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "facebook" }}
<a href="{{ . }}" target="_blank" class="link-transition facebook link dib z-999 pt3 pt0-l mr1" title="Facebook link" rel="noopener" aria-label="follow on Facebook——Opens in a new window">
  {{ partial "svg/facebook.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "twitter" }}
<a href="{{ . }}" target="_blank" class="link-transition twitter link dib z-999 pt3 pt0-l mr1" title="Twitter link" rel="noopener" aria-label="follow on Twitter——Opens in a new window">
  {{ partial "svg/twitter.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "instagram" }}
<a href="{{ . }}" target="_blank" class="link-transition instagram link dib z-999 pt3 pt0-l mr1" title="Instagram link" rel="noopener" aria-label="follow on Instagram——Opens in a new window">
  {{ partial "svg/instagram.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "youtube" }}
<a href="{{ . }}" target="_blank" class="link-transition youtube link dib z-999 pt3 pt0-l mr1" title="Youtube link" rel="noopener" aria-label="follow on Youtube——Opens in a new window">
  {{ partial "svg/youtube.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "linkedin" }}
<a href="{{ . }}" target="_blank" class="link-transition linkedin link dib z-999 pt3 pt0-l mr1" title="LinkedIn link" rel="noopener" aria-label="follow on LinkedIn——Opens in a new window">
  {{ partial "svg/linkedin.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "github" }}
<a href="{{ . }}" target="_blank" class="link-transition github link dib z-999 pt3 pt0-l mr1" title="Github link" rel="noopener" aria-label="follow on Github——Opens in a new window">
  {{ partial "svg/github.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "gitlab" }}
<a href="{{ . }}" target="_blank" class="link-transition gitlab link dib z-999 pt3 pt0-l mr1" title="Gitlab link" rel="noopener" aria-label="follow on Gitlab——Opens in a new window">
  {{ partial "svg/gitlab.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "keybase" }}
<a href="{{ . }}" target="_blank" class="link-transition keybase link dib z-999 pt3 pt0-l mr1" title="Keybase link" rel="noopener" aria-label="follow on Keybase——Opens in a new window">
  {{ partial "svg/keybase.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "medium" }}
<a href="{{ . }}" target="_blank" class="link-transition medium link dib z-999 pt3 pt0-l mr1" title="Medium link" rel="noopener" aria-label="follow on Medium——Opens in a new window">
  {{ partial "svg/medium.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "mastodon" }}
<a href="{{ . }}" target="_blank" class="link-transition mastodon link dib z-999 pt3 pt0-l mr1" title="Mastodon link" rel="noopener" aria-label="follow on Mastodon——Opens in a new window">
  {{ partial "svg/mastodon.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "slack" }}
<a href="{{ . }}" target="_blank" class="link-transition slack link dib z-999 pt3 pt0-l mr1" title="Slack link" rel="noopener" aria-label="follow on Slack——Opens in a new window">
  {{ partial "svg/slack.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "rss" }}
<a href="{{ . }}" target="_blank" class="link-transition rss link dib z-999 pt3 pt0-l mr1" title="RSS link" rel="noopener" aria-label="RSS——Opens in a new window">
  {{ partial "svg/rss.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "tiktok" }}
<a href="{{ . }}" target="_blank" class="link-transition tiktok link dib z-999 pt3 pt0-l mr1" title="TikTok link" rel="noopener" aria-label="follow on TikTok——Opens in a new window">
  {{ partial "svg/tiktok.svg" (dict "size" $icon_size) }}
  {{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
layouts/partials/summary-with-image.html
@@ -6,21 +6,21 @@
          {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
        {{ $featured_image := (trim $featured_image "/") | absURL }}
        <div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
          <a href="{{.Permalink}}" class="db grow">
          <a href="{{.RelPermalink}}" class="db grow">
            <img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
          </a>
        </div>
      {{ end }}
      <div class="blah w-100{{ if $featured_image }} w-60-ns pl3-ns{{ end }}">
        <h1 class="f3 fw1 athelas mt0 lh-title">
          <a href="{{.Permalink}}" class="color-inherit dim link">
          <a href="{{.RelPermalink}}" class="color-inherit dim link">
            {{ .Title }}
            </a>
        </h1>
        <div class="f6 f5-l lh-copy nested-copy-line-height nested-links">
          {{ .Summary }}
        </div>
          <a href="{{.Permalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a>
          <a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a>
        {{/* TODO: add author
        <p class="f6 lh-copy mv0">By {{ .Author }}</p> */}}
      </div>
layouts/partials/summary.html
@@ -2,7 +2,7 @@
  <div class="bg-white mb3 pa4 gray overflow-hidden">
    <span class="f6 db">{{ humanize .Section }}</span>
    <h1 class="f3 near-black">
      <a href="{{ .Permalink }}" class="link black dim">
      <a href="{{ .RelPermalink }}" class="link black dim">
        {{ .Title }}
      </a>
    </h1>
layouts/partials/svg/tiktok.svg
New file
@@ -0,0 +1,6 @@
<svg{{ with .size }} height="{{ . }}" {{ end }} style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32"
 width="{{ .size }}" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path
     d="m 15.433,1.91 c 7.726455,0 14,6.265147 14,14 0,7.726455 -6.265147,14 -14,14 -7.7264547,0 -14,-6.265147 -14,-14 0,-7.7264547 6.265147,-14 14,-14 z m 3.031794,6.2483503 c 0.260348,2.2003597 1.486502,3.5104977 3.611277,3.6448707 v 2.469107 c -1.234553,0.117576 -2.317936,-0.285543 -3.577684,-1.041392 v 4.619076 c 0,5.878824 -6.407918,7.709658 -8.9778045,3.5021 -1.6544691,-2.70426 -0.6382724,-7.466107 4.6694665,-7.65087 v 2.611877 c -0.40312,0.06719 -0.831434,0.167967 -1.226155,0.30234 -1.184163,0.394721 -1.847631,1.15057 -1.662868,2.469106 0.361128,2.527895 4.997001,3.275345 4.610678,-1.662867 V 8.1667487 h 2.561488 z"
     style="fill-rule:evenodd;clip-rule:evenodd;"/>
</svg>
layouts/post/summary-with-image.html
@@ -1,5 +1,5 @@
<article class="bb b--black-10">
  <a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .Permalink }}">
  <a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .RelPermalink }}">
    <div class="flex flex-column flex-row-ns">
      {{ $featured_image := partial "func/GetFeaturedImage.html" . }}
      {{ if $featured_image }}
layouts/post/summary.html
@@ -1,11 +1,11 @@
  <div class="mb3 pa4 mid-gray overflow-hidden">
    {{ if .Date }}
      <div class="f6">
        {{ .Date.Format "January 2, 2006" }}
        {{ .Date.Format (default "January 2, 2006" .Site.Params.date_format) }}
      </div>
    {{ end }}
    <h1 class="f3 near-black">
      <a href="{{ .Permalink }}" class="link black dim">
      <a href="{{ .RelPermalink }}" class="link black dim">
        {{ .Title }}
      </a>
    </h1>