re-added scope variable to differentiate between list and single pages

master
Lars Hoogestraat 8 months ago
parent f0e29bf4c5
commit ee61489da8
  1. 2
      exampleSite/config.toml
  2. 1
      layouts/_default/list.html
  3. 7
      layouts/partials/article-header.html
  4. 21
      layouts/posts/list.html
  5. 14
      layouts/posts/single.html

@ -1,4 +1,4 @@
baseURL = 'http://localhost/'
baseURL = 'https://hugodemo.hoogi.eu/'
languageCode = "en-us"
DefaultContentLanguage = "en"
title = 'This is an example site'

@ -1,5 +1,6 @@
{{ define "main" }}
{{ range .Paginator.Pages }}
{{ .Scratch.Set "scope" "list" }}
<article>
<header>
<h1>

@ -1,6 +1,9 @@
<h1>
{{.Title}}
<a href="{{.Permalink}}">{{.Title}}</a>
{{ if eq (.Scratch.Get "scope") "single" }}
{{.Title}}
{{ else }}
<a href="{{.Permalink}}">{{.Title}}</a>
{{ end }}
</h1>
<p>
{{ if .Date }} written {{ if .Params.Author }} by {{ .Params.Author }} {{ end }} on

@ -0,0 +1,21 @@
{{ define "main" }}
{{ range .Paginator.Pages }}
{{ .Scratch.Set "scope" "list" }}
<article>
<header>
{{ partial "article-header.html" . }}
</header>
{{ if .Site.Params.useSummary }}
{{ .Summary }}
{{ partial "article-footer.html" . }}
{{ else }}
{{.Content}}
{{ partial "article-footer.html" . }}
{{ end }}
</article>
{{ end }}
{{ partial "pagination.html" . }}
{{ end }}

@ -2,19 +2,7 @@
{{ .Scratch.Set "scope" "single" }}
<article>
<header>
<h1>
{{.Title}}
</h1>
<p>
{{ if .Date }} written {{ if .Params.Author }} by {{ .Params.Author }} {{ end }} on
<time>{{ .Date.Format "Jan 2, 2006" }}</time>{{ end }}
{{ if .Params.categories }}
in
{{ range .Params.categories }}
<a href="{{ $.Site.BaseURL }}categories/{{ . | urlize }}">{{ . | humanize }}</a>
{{ end }}
{{ end }}
</p>
{{ partial "article-header.html" . }}
</header>
{{ .Content }}
</article>

Loading…
Cancel
Save