-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adds new Hugo feature (https://gohugo.io/functions/dateformat/#datetime-formatting-layouts) enabling date localization in defaults
- Loading branch information
1 parent
052a699
commit fade059
Showing
7 changed files
with
137 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
{{ define "main" }} | ||
<div class="container markdown top-pad"> | ||
{{ .Content }} | ||
</div> | ||
<div class="container"> | ||
<ul> | ||
{{ range .Pages.ByPublishDate.Reverse }} | ||
{{ if .Date }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title | markdownify }}</a> | ||
</li> | ||
{{ else }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
</ul> | ||
</div> | ||
<div class="container markdown top-pad"> | ||
{{ .Content }} | ||
</div> | ||
<div class="container"> | ||
<ul> | ||
{{ range .Pages.ByPublishDate.Reverse }} | ||
{{ if .Date }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }} | | ||
{{ .Title | markdownify }}</a> | ||
</li> | ||
{{ else }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
</ul> | ||
</div> | ||
</body> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
{{ define "title" }} | ||
<h1 class="bold-title is-1">{{ .Data.Singular | humanize }}: {{ lower .Title | markdownify }}</h1> | ||
<h1 class="bold-title is-1">{{ .Data.Singular | humanize }}: {{ lower .Title | markdownify }}</h1> | ||
{{ end }} | ||
|
||
{{ define "main" }} | ||
<div class="container"> | ||
<ul> | ||
{{ range .Pages.ByPublishDate.Reverse }} | ||
{{ if .Date }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title | markdownify }}</a> | ||
</li> | ||
{{ else }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
</ul> | ||
</div> | ||
<div class="container"> | ||
<ul> | ||
{{ range .Pages.ByPublishDate.Reverse }} | ||
{{ if .Date }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }} | | ||
{{ .Title | markdownify }}</a> | ||
</li> | ||
{{ else }} | ||
<li> | ||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
</ul> | ||
</div> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
{{ define "main" }} | ||
<div class="container markdown top-pad"> | ||
{{ .Content }} | ||
</div> | ||
<div class="container"> | ||
{{ if .Site.Params.home.showLatest | default true }} | ||
<h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2> | ||
{{ range first 1 .Pages.ByPublishDate.Reverse }} | ||
<div class="summary">{{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}{{ end }} | ||
<h3 class="title is-3 strong-post-title"> | ||
<a href="{{ .Permalink }}"> | ||
{{ .Title | markdownify }} | ||
</a> | ||
</h3> | ||
<div class="markdown"> | ||
{{ .Summary }} | ||
{{ if .Truncated }} | ||
<a href="{{ .Permalink }}">{{ i18n "index_blog_readMore" . }}</a> | ||
{{ end }} | ||
</div> | ||
</div> | ||
<div class="container markdown top-pad"> | ||
{{ .Content }} | ||
</div> | ||
<div class="container"> | ||
{{ if .Site.Params.home.showLatest | default true }} | ||
<h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2> | ||
{{ range first 1 .Pages.ByPublishDate.Reverse }} | ||
<div class="summary"> | ||
{{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}{{ end }} | ||
<h3 class="title is-3 strong-post-title"> | ||
<a href="{{ .Permalink }}"> | ||
{{ .Title | markdownify }} | ||
</a> | ||
</h3> | ||
<div class="markdown"> | ||
{{ .Summary }} | ||
{{ if .Truncated }} | ||
<a href="{{ .Permalink }}">{{ i18n "index_blog_readMore" . }}</a> | ||
{{ end }} | ||
{{ end }} | ||
<h2 class="title is-2 top-pad">{{ i18n "index_blog_allPosts" . }}</h2> | ||
{{if .Site.Params.home.allPostsArchiveFormat}} | ||
{{ partialCached "blog/archive.html" .}} | ||
{{else}} | ||
{{ partialCached "blog/li.html" . }} | ||
{{end}} | ||
</div> | ||
</div> | ||
{{ end }} | ||
{{ end }} | ||
<h2 class="title is-2 top-pad">{{ i18n "index_blog_allPosts" . }}</h2> | ||
{{if .Site.Params.home.allPostsArchiveFormat}} | ||
{{ partialCached "blog/archive.html" .}} | ||
{{else}} | ||
{{ partialCached "blog/li.html" . }} | ||
{{end}} | ||
</div> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
<section> | ||
{{ $prev := now.Format "2006"}} <!--start from the current year--> | ||
{{ range first 1 .Pages.ByPublishDate.Reverse }} | ||
{{if .Date}} <!--also add the header if there are posts during the current year--> | ||
{{if eq $prev (.Date.Format "2006")}} <h2 class="title is-2 top-pad"> {{ $prev }}</h2> {{end}} | ||
{{ $prev := now.Format "2006"}} | ||
<!--start from the current year--> | ||
{{ range first 1 .Pages.ByPublishDate.Reverse }} | ||
{{if .Date}} | ||
<!--also add the header if there are posts during the current year--> | ||
{{if eq $prev (.Date.Format "2006")}} | ||
<h2 class="title is-2 top-pad"> {{ $prev }}</h2> {{end}} | ||
{{end}} | ||
{{end}} | ||
{{end}} | ||
|
||
{{range .Pages.ByPublishDate.Reverse}} | ||
{{range .Pages.ByPublishDate.Reverse}} | ||
{{if .Date}} | ||
{{$curr := .Date.Format "2006"}} | ||
{{if lt $curr $prev }} | ||
<h2 class="title is-2 top-pad">{{ $curr }}</h2> | ||
{{end}} | ||
{{if lt $curr $prev }} | ||
<h2 class="title is-2 top-pad">{{ $curr }}</h2> | ||
{{end}} | ||
<li class="post-item"> | ||
{{ if .Params.date }} | ||
<span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span> - | ||
{{ end }} | ||
<span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span> | ||
{{ if .Params.date }} | ||
<span>{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}</span> - | ||
{{ end }} | ||
<span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span> | ||
</li> | ||
{{ $prev = $curr}} | ||
{{ $prev = $curr}} | ||
{{end}} | ||
{{end}} | ||
{{end}} | ||
</section> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{{ range .Pages.ByPublishDate.Reverse }} | ||
<li class="post-item"> | ||
<span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span>{{ if .Params.date }} - <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span>{{ end }} | ||
</li> | ||
<li class="post-item"> | ||
<span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span>{{ if .Params.date }} - | ||
<span>{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}</span>{{ end }} | ||
</li> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters