Skip to content

Commit

Permalink
Merge pull request #1 from kenkeiras/fix-gl-post-dates
Browse files Browse the repository at this point in the history
Fix galician post dates, and make compatible with Hugo > 0.75.1
  • Loading branch information
hacklego authored Nov 27, 2020
2 parents 9269700 + 8965160 commit ffc49b5
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 2 deletions.
12 changes: 12 additions & 0 deletions data/months_gl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
1: "Xaneiro"
2: "Febreiro"
3: "Marzo"
4: "Abril"
5: "Maio"
6: "Xuño"
7: "Xullo"
8: "Agosto"
9: "Setembro"
10: "Outubro"
11: "Novembro"
12: "Decembro"
74 changes: 74 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Content
- id: dateFormat
translation: "January 2, 2006"
- id: shortdateFormat
translation: "Jan 2, 2006 15:04:05"
- id: postedOnDate
translation: "Posted on {{ . }}"
- id: lastModified
translation: "(Last modified on {{ . }})"
- id: translationsLabel
translation: "Other languages: "
- id: translationsSeparator
translation: ", "
- id: readMore
translation: "Read More"
- id: olderPosts
translation: "Older Posts"
- id: newerPosts
translation: "Newer Posts"
- id: previousPost
translation: "Previous Post"
- id: nextPost
translation: "Next Post"
- id: readTime
translation: "minutes"
- id: words
translation: "words"


# 404 page
- id: pageNotFound
translation: "Whoops, this page doesn't exist. Move along. (404 error)"

# Footer
- id: poweredBy # Accepts HTML
translation: '<a href="https://gohugo.io">Hugo v{{ .Site.Hugo.Version }}</a> powered &nbsp;&bull;&nbsp; Theme <a href="https://github.com/halogenica/beautifulhugo">Beautiful Hugo</a> adapted from <a href="https://deanattali.com/beautiful-jekyll/">Beautiful Jekyll</a>'

# Navigation
- id: toggleNavigation
translation: "Toggle navigation"
- id: languageSwitcherLabel
translation: "Language"
- id: gcseLabelShort
translation: "Search"
- id: gcseLabelLong
translation: "Search {{ .Site.Title }}"
- id: gcseClose
translation: "Close"

# Staticman
- id: noComment
translation: "No comment"
- id: oneComment
translation: "comment"
- id: moreComment
translation: "comments"
- id: useMarkdown
translation: "You can use Markdown syntax"
- id: yourName
translation: "Your name"
- id: yourEmail
translation: "Your email address"
- id: yourWebsite
translation: "You website"

# Delayed Disqus
- id: show
translation: "Show"
- id: comments
translation: "comments"

# Related posts
- id: seeAlso
translation: "See also"
4 changes: 2 additions & 2 deletions i18n/gl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
- id: shortdateFormat
translation: "2 Jan, 2006 15:04:05"
- id: postedOnDate
translation: "Publicado o {{ .Count }}"
translation: "Publicado o {{ . }}"
- id: lastModified
translation: "(Última modificación en {{ .Count }})"
translation: "(Última modificación en {{ . }})"
- id: translationsLabel
translation: "Outros idiomas: "
- id: translationsSeparator
Expand Down
5 changes: 5 additions & 0 deletions layouts/partials/date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ if eq "gl" .language.Lang }}
{{ .date.Day }}. {{ index .months_gl (printf "%d" .date.Month) }} {{ .date.Year }}
{{ else }}
{{ .date.Format "January 2, 2006" }}
{{ end }}
48 changes: 48 additions & 0 deletions layouts/partials/post_meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<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>&nbsp;

{{ partial "date.html" (dict "date" .Date "language" $.Page.Language "months_gl" $.Site.Data.months_gl) | i18n "postedOnDate" }}

{{ if ne $datestr $lastmodstr }}
&nbsp;{{ $lastmodstr | i18n "lastModified" }}
{{ end }}
{{ if .Site.Params.readingTime }}
&nbsp;|&nbsp;<i class="fas fa-clock"></i>&nbsp;{{ i18n "readingTime"}}{{ .ReadingTime }}&nbsp;{{ i18n "readTime" }}
{{ end }}
{{ if .Site.Params.wordCount }}
&nbsp;|&nbsp;<i class="fas fa-book"></i>&nbsp;{{ .WordCount }}&nbsp;{{ i18n "words" }}
{{ end }}
{{ if not .Site.Params.hideAuthor }}
{{ if .Params.author }}
&nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Params.author | safeHTML }}
{{ else }}
&nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Site.Author.name | safeHTML }}
{{ end }}
{{ end }}
{{- if .Site.Params.staticman -}}
&nbsp;|&nbsp;<i class="fas fa-comment"></i>&nbsp;
{{ $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") -}}
&nbsp;&bull;&nbsp;{{ i18n "translationsLabel" }}{{ $linksOutput }}
{{- end }}
</span>

0 comments on commit ffc49b5

Please sign in to comment.