mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
refactor: site locale params under params.locale
BREAKING CHANGE: in params.yaml: ``` date_format: 'Jan 2, 2006' time_format: '3:04 PM' address_format: en-us ``` to ``` locale: date_format: 'Jan 2, 2006' time_format: '3:04 PM' address_format: en-us ```
This commit is contained in:
parent
98f15e88e2
commit
d615d9d89c
5 changed files with 12 additions and 13 deletions
|
@ -46,14 +46,15 @@ module:
|
|||
target: i18n
|
||||
- source: archetypes
|
||||
target: archetypes
|
||||
params:
|
||||
theme: minimal
|
||||
font: native
|
||||
date_format: 'Jan 2, 2006'
|
||||
time_format: '3:04 PM'
|
||||
address_format: en-us
|
||||
security:
|
||||
funcs:
|
||||
getenv:
|
||||
- ^HUGO_
|
||||
- ^WC_
|
||||
params:
|
||||
theme: minimal
|
||||
font: native
|
||||
locale:
|
||||
date_format: 'Jan 2, 2006'
|
||||
time_format: '3:04 PM'
|
||||
address_format: en-us
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<div class="body-footer">
|
||||
<p>{{ i18n "last_updated" }} {{ $.Lastmod | time.Format site.Params.date_format }}</p>
|
||||
<p>{{ i18n "last_updated" }} {{ $.Lastmod | time.Format site.Params.locale.date_format }}</p>
|
||||
|
||||
{{ partial "page_edit" . }}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{/* Function to get event start and end dates/times. */}}
|
||||
{{ $t1 := time .Date }}{{/* Start datetime. */}}
|
||||
{{ $str := slice (time.Format site.Params.date_format (time $t1)) }}{{/* Init return string with start date. */}}
|
||||
{{ $str := slice (time.Format site.Params.locale.date_format (time $t1)) }}{{/* Init return string with start date. */}}
|
||||
{{/* Show start time if not all day event. */}}
|
||||
{{ if not .Params.all_day }}{{ $str = $str | append (time.Format site.Params.time_format (time $t1)) }}{{ end }}
|
||||
{{/* Show event end date if provided. */}}
|
||||
|
@ -9,7 +9,7 @@
|
|||
{{ $t2 := time .Params.date_end}}{{/* End datetime. */}}
|
||||
{{/* Show end date if it differs to start date. */}}
|
||||
{{ if not (eq $t1.Year $t2.Year | and (eq $t1.Month $t2.Month) | and (eq $t1.Day $t2.Day)) }}
|
||||
{{ $str = $str | append (time.Format site.Params.date_format (time $t2)) }}
|
||||
{{ $str = $str | append (time.Format site.Params.locale.date_format (time $t2)) }}
|
||||
{{ end }}
|
||||
{{/* Show end time if not all day event. */}}
|
||||
{{ if not .Params.all_day }}{{ $str = $str | append (time.Format site.Params.time_format (time $t2)) }}{{ end }}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{{ if not (in (slice "event" "page") $page.Type) | and (ne $page.Params.show_date false) }}
|
||||
<span class="article-date">
|
||||
{{ $date := $page.Lastmod | time.Format site.Params.date_format }}
|
||||
{{ $date := $page.Lastmod | time.Format site.Params.locale.date_format }}
|
||||
{{ if eq $page.Type "publication" }}
|
||||
{{ $date = $page.Date | time.Format (site.Params.publications.date_format | default "January, 2006") }}
|
||||
{{ else }}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ site.LanguageCode | default "en-us" }}">
|
||||
<head>
|
||||
{{ $media_dir := site.Params.media_dir | default "media" }}
|
||||
{{ .Scratch.Set "media_dir" $media_dir }}
|
||||
|
||||
{{ $css := site.Data.assets.css }}
|
||||
{{ $cdn_url_reveal := "https://cdn.jsdelivr.net/npm/reveal.js@4.2.1" }}
|
||||
{{ $js := site.Data.assets.js }}
|
||||
{{ $css := site.Data.assets.css }}
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue