Bladeren bron

[Feat] Created ability to create standalone posts that do not display date.

This behaviour is now managed by a single partial template rather than hardcoding.
main
Roxie Gibson 4 jaren geleden
bovenliggende
commit
91f8dc62c1
Geen bekende sleutel gevonden voor deze handtekening in de database
4 gewijzigde bestanden met toevoegingen van 18 en 12 verwijderingen
  1. +1
    -5
      layouts/_default/list.html
  2. +4
    -2
      layouts/_default/single.html
  3. +2
    -5
      layouts/index.html
  4. +11
    -0
      layouts/partials/listing.html

+ 1
- 5
layouts/_default/list.html Bestand weergeven

@@ -11,11 +11,7 @@

<!-- orders content according to the "publishdate" field in front matter -->
{{ range .Pages.ByPublishDate }}
<div>
<a href="{{ .Permalink }}">{{ .Title }}</a><br />
<time>{{ .Date.Format "January 2, 2006" }}</time>
</div>
<br />
{{ partial "listing.html" . }}
{{ end }}
</div>
</body>

+ 4
- 2
layouts/_default/single.html Bestand weergeven

@@ -4,8 +4,10 @@
<html>
{{ partial "page_header.html" . }}
<h1>{{ .Title }}</h1>
<p class="post-meta"><time itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</time>
</p>
{{ if ne .Params.Standalone true }}
<p class="post-meta"><time itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</time></p>
{{ end }}

{{ .Content }}

{{ partial "footer.html" . }}

+ 2
- 5
layouts/index.html Bestand weergeven

@@ -32,11 +32,8 @@

<!-- orders content according to the "publishdate" field in front matter -->
{{ range first .Site.Data.personalize.PostLimit .Pages.ByPublishDate }}
<div>
<a href="{{ .Permalink }}">{{ .Title }}</a><br />
<time>{{ .Date.Format "January 2, 2006" }}</time>
</div>
<br />
<!-- TODO: Make consistent with other list pages -->
{{ partial "listing.html" . }}
{{ end }}



+ 11
- 0
layouts/partials/listing.html Bestand weergeven

@@ -0,0 +1,11 @@
<!-- Single listing in list of posts. Used in index and list pages. -->


<!-- If type is page, not a blog post, class as a unique page with no date. Do not show in listings -->
{{ if ne .Params.Standalone true }}
<div>
<a href="{{ .Permalink }}">{{ .Title }}</a><br />
<time>{{ .Date.Format "January 2, 2006" }}</time>
</div>
<br />
{{ end }}

Laden…
Annuleren
Opslaan