Skip to content

Commit

Permalink
Merge pull request #66 from razonyang/feature-date-format
Browse files Browse the repository at this point in the history
Add parameter dateFormat
  • Loading branch information
onweru committed Oct 12, 2020
2 parents a870ab6 + bc3b559 commit f59e0e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -161,6 +161,7 @@ These options set global values that some pages or all pages in the site use by
| comment | boolean | no |
| numberOfRecentPosts | integer | no |
| numberOfFeaturedPosts | integer | no |
| dateFormat | string | no |

### Page Parameters

Expand Down
3 changes: 3 additions & 0 deletions exampleSite/config.toml
Expand Up @@ -104,3 +104,6 @@ languageMenuName = "🌐"

# Maximum number of featured posts.
# numberOfFeaturedPosts = 8

# Date format. Checkout https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference for details.
# dateFormat = "2006-01-02" # Default to "Jan 2, 2006".
2 changes: 1 addition & 1 deletion layouts/partials/post-meta.html
@@ -1,7 +1,7 @@
<div class="post_meta">
{{ partial "sprite" (dict "icon" "calendar") }}
<span class="post_date">
{{ .Date.Format "Jan 2, 2006" -}}
{{ .Date.Format (default "Jan 2, 2006" $.Site.Params.dateFormat) -}}
</span>
{{- with .Params.tags -}}
{{- range . }}
Expand Down

0 comments on commit f59e0e1

Please sign in to comment.