diff options
author | EuAndreh <eu@euandre.org> | 2020-08-12 12:06:07 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-12 12:06:07 -0300 |
commit | 3720c8b0146c10a63dc1d9eba0556e0a67adfd1d (patch) | |
tree | 463e3dc33553c05f85275617617f342cb20f38ab | |
parent | scripts/assert-content.sh: Add check for missing title (diff) | |
download | euandre.org-3720c8b0146c10a63dc1d9eba0556e0a67adfd1d.tar.gz euandre.org-3720c8b0146c10a63dc1d9eba0556e0a67adfd1d.tar.xz |
Use _includes/i18n-date.html for dates
-rw-r--r-- | _config.yml | 30 | ||||
-rw-r--r-- | _includes/i18n-date.html | 11 | ||||
-rw-r--r-- | _layouts/index.html | 2 | ||||
-rw-r--r-- | _layouts/pastebin.html | 2 | ||||
-rw-r--r-- | _layouts/pastebins-listing.html | 2 | ||||
-rw-r--r-- | _layouts/post.html | 6 | ||||
-rw-r--r-- | _layouts/tils-listing.html | 2 |
7 files changed, 45 insertions, 10 deletions
diff --git a/_config.yml b/_config.yml index 2fdccd6..18677c9 100644 --- a/_config.yml +++ b/_config.yml @@ -76,9 +76,6 @@ t: til: en: "/feed.til.en.atom" pt: "/feed.til.pt.atom" - date_format: - en: "%B %-d, %Y" - pt: "%-d de %B de %Y" posted_on: en: "Posted on" pt: "Postado em" @@ -100,3 +97,30 @@ t: The content for this site is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>. The <a href="https://git.sr.ht/~euandreh/website">code</a> is <a href="https://git.sr.ht/~euandreh/website/tree/master/LICENSE">GPLv3 or later</a>. pt: >- O conteúdo desse site é licensiado sob a licença <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>. O <a href="https://git.sr.ht/~euandreh/website">código</a> é <a href="https://git.sr.ht/~euandreh/website/tree/master/LICENSE">GPLv3 ou versões maiores</a>. + months: + en: + - January + - February + - March + - April + - May + - June + - July + - August + - September + - October + - November + - December + pt: + - Janeiro + - Fevereiro + - Março + - Abril + - Mail + - Junho + - Julho + - Agosto + - Setembro + - Outubro + - Novembro + - Dezembro diff --git a/_includes/i18n-date.html b/_includes/i18n-date.html new file mode 100644 index 0000000..9b73600 --- /dev/null +++ b/_includes/i18n-date.html @@ -0,0 +1,11 @@ +{% capture i18n_month %} +{% assign m = include.date | date: "%-m" | minus: 1 %} +{{ site.t.months[page.lang][m] }} +{% endcapture %} +{% if page.lang == "en" %} + <!-- handcrafting the "%B %-d, %Y" date format --> + {{ i18n_month }}{{ include.date | date: "%-d, %Y" }} +{% elsif page.lang == "pt" %} + <!-- handcrafting the "%-d de %B de %Y" date format --> + {{ include.date | date: "%-d de " }}{{ i18n_month }}{{ include.date | date: " de %Y" }} +{% endif %} diff --git a/_layouts/index.html b/_layouts/index.html index 1ce99ca..2e39734 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -12,7 +12,7 @@ layout: default <ul> {%- for post in lposts -%} <li> - <a href="{{ post.url }}">{{ post.title | escape }}</a> - {{ post.date | date: site.t.date_format[page.lang] }} + <a href="{{ post.url }}">{{ post.title | escape }}</a> - {% include i18n-date.html date=post.date %} </li> {%- endfor -%} </ul> diff --git a/_layouts/pastebin.html b/_layouts/pastebin.html index 21e4f65..4314ca2 100644 --- a/_layouts/pastebin.html +++ b/_layouts/pastebin.html @@ -3,7 +3,7 @@ layout: default --- <article> <section class="header"> - Posted on {{ page.date | date: site.t.date_format[page.lang] }} + Posted on {% include i18n-date.html date=page.date %} </section> <section> {{ content }} diff --git a/_layouts/pastebins-listing.html b/_layouts/pastebins-listing.html index 4c37c93..58837e1 100644 --- a/_layouts/pastebins-listing.html +++ b/_layouts/pastebins-listing.html @@ -6,7 +6,7 @@ layout: default {% assign pastebins = site.pastebins | sort: "date" | reverse %} {%- for pastebin in pastebins -%} <li> - <a href="{{ pastebin.url | relative_url }}">{{ pastebin.title | escape }}</a> - {{ pastebin.date | date: site.t.date_format[page.lang] }} + <a href="{{ pastebin.url | relative_url }}">{{ pastebin.title | escape }}</a> - {% include i18n-date.html date=pastebin.date %} </li> {%- endfor -%} </ul> diff --git a/_layouts/post.html b/_layouts/post.html index 18debe5..0bb165f 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -3,11 +3,11 @@ layout: default --- <article> <section class="header"> - {{ site.t.posted_on[page.lang] }} {{ page.date | date: site.t.date_format[page.lang] }} + {{ site.t.posted_on[page.lang] }} {% include i18n-date.html date=page.date %} </section> {% if page.updated_at %} - <section class="header"> - {{ site.t.updated_at[page.lang] }} {{ page.updated_at | date: site.t.date_format[page.lang] }} + <section class="header"> + {{ site.t.updated_at[page.lang] }} </section> {% endif %} <section> diff --git a/_layouts/tils-listing.html b/_layouts/tils-listing.html index e254125..38cec2b 100644 --- a/_layouts/tils-listing.html +++ b/_layouts/tils-listing.html @@ -12,7 +12,7 @@ layout: default {% assign tils = site.tils | where:"lang", page.lang | sort: "date" | reverse %} {%- for til in tils -%} <li> - <a href="{{ til.url | relative_url }}">{{ til.title | escape }}</a> - {{ til.date | date: site.t.date_format[page.lang] }} + <a href="{{ til.url | relative_url }}">{{ til.title | escape }}</a> - {% include i18n-date.html date=til.date %} </li> {%- endfor -%} </ul> |