mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2023-12-21 10:22:58 +01:00
localize post dates
This commit is contained in:
@ -89,6 +89,19 @@
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* localize dates */}}
|
||||
{{- if (not site.Params.disableDateLocalization) }}
|
||||
{{ $defines := dict "process.env.lang_code" (printf `"%s"` site.LanguageCode) }}
|
||||
{{ $opts := dict "targetPath" "datelocale.ts" "defines" $defines }}
|
||||
{{- if not site.Params.assets.disableFingerprinting }}
|
||||
{{ $built := resources.Get "js/datelocale.ts" | js.Build $opts | fingerprint }}
|
||||
<script defer crossorigin="anonymous" src="{{ $built.Permalink }}" integrity="{{ $built.Data.Integrity }}"></script>
|
||||
{{- else }}
|
||||
{{ $built := resources.Get "js/datelocale.js" | js.Build $opts }}
|
||||
<script defer crossorigin="anonymous" src="{{ $built.Permalink }}"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Highlight.js */}}
|
||||
{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default .Params.disableHLJS ) }}
|
||||
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{- $scratch := newScratch }}
|
||||
|
||||
{{- if not .Date.IsZero -}}
|
||||
{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }}
|
||||
{{- $scratch.Add "meta" (slice (printf "<span class='localizable-date' title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }}
|
||||
{{- end }}
|
||||
|
||||
{{- if (.Param "ShowReadingTime") -}}
|
||||
|
Reference in New Issue
Block a user