Fix ordering of conditionals to allow both single page site mode and normal blog mode. Add semantic tags
This commit is contained in:
parent
896dbba4cf
commit
a667d2d6db
@ -9,6 +9,20 @@ paginate = 5
|
|||||||
showMenuItems = 2
|
showMenuItems = 2
|
||||||
fullWidthTheme = false
|
fullWidthTheme = false
|
||||||
centerTheme = false
|
centerTheme = false
|
||||||
|
# singlePageSite moves pages from the main nav menu to sections on the homepage.
|
||||||
|
# These only menu items with a url set to "/#section-name" will be displayed.
|
||||||
|
# A collection is displayed for the menu identifier which matches contentTypeName.
|
||||||
|
# The collection items use the "post" archetypes.
|
||||||
|
singlePageSite = true
|
||||||
|
# For singlePageSites the collection is paginated but it would not make sense to
|
||||||
|
# paginate in the middle of a section, so a link to see more can be specified below.
|
||||||
|
singlePageCollectionSeeMoreText = "Check out my projects!"
|
||||||
|
singlePageCollectionSeeMoreLink = "/portfolio"
|
||||||
|
|
||||||
|
[params.twitter]
|
||||||
|
creator = "@justinnuwin"
|
||||||
|
site = "@justinnuwin"
|
||||||
|
|
||||||
|
|
||||||
[languages]
|
[languages]
|
||||||
[languages.en]
|
[languages.en]
|
||||||
|
@ -6,33 +6,35 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Site.Params.singlePageSite }}
|
<!-- Variables for collection of posts -->
|
||||||
|
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
|
||||||
|
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
|
||||||
|
|
||||||
<!-- Variables for collection of posts -->
|
{{ $PageContext := . }}
|
||||||
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
|
{{ if .IsHome }}
|
||||||
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
|
|
||||||
|
|
||||||
{{ $PageContext := . }}
|
|
||||||
{{ if .IsHome }}
|
|
||||||
{{ $PageContext = .Site }}
|
{{ $PageContext = .Site }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
|
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
|
||||||
|
|
||||||
<div class="sections">
|
<div class="sections">
|
||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
{{ if in (first 2 .URL) "#" }}
|
{{ if eq (first 2 .URL) "/#" }}
|
||||||
<div id="{{ .Identifier }}" class="posts section">
|
<section id="{{ .Identifier }}" class="posts section">
|
||||||
<h1 class="section-header">{{ .Name }}</h1>
|
{{ if $.Site.Params.singlePageSite }}
|
||||||
|
<h1 class="section-header">{{ .Name }}<a href="#{{ .Identifier }}" class="hanchor" arialabel="Anchor">⌗</a></h1>
|
||||||
|
{{ end }}
|
||||||
{{ if ne .Identifier $.Site.Params.contentTypeName }}
|
{{ if ne .Identifier $.Site.Params.contentTypeName }}
|
||||||
|
{{ if $.Site.Params.singlePageSite }}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
{{ $section := path.Join "homepage" .Identifier }}
|
{{ $section := path.Join "homepage" .Identifier }}
|
||||||
{{ with $.Site.GetPage $section }}
|
{{ with $.Site.GetPage $section }}
|
||||||
{{ partial "section.html" . }}
|
{{ partial "section.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
<div class="post on-list">
|
<article class="post on-list">
|
||||||
<h1 class="post-title">
|
<h1 class="post-title">
|
||||||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
||||||
</h1>
|
</h1>
|
||||||
@ -81,16 +83,29 @@
|
|||||||
href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</article>
|
||||||
{{ end }}
|
|
||||||
<!--{ { partial "pagination.html" $ } }--> TODO: Update pagination <!-- originally . instead of $ -->
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if $.Site.Params.singlePageSite }}
|
||||||
|
<div class="pagination">
|
||||||
|
<div class="pagination__buttons">
|
||||||
|
<span class="button previous">
|
||||||
|
<a href="{{ $.Site.Params.singlePageCollectionSeeMoreLink }}">
|
||||||
|
<span class="button__icon">→</span>
|
||||||
|
<span class="button__text">{{ $.Site.Params.singlePageCollectionSeeMoreText }}</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ else }}
|
||||||
|
{{ partial "pagination.html" $ }} <!-- originally . instead of $ -->
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
||||||
|
{{ if $.Site.Params.singlePageSite }}
|
||||||
<hr class="section-separator">
|
<hr class="section-separator">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
{{ end }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
<div class="post on-list">
|
<article class="post on-list">
|
||||||
<h1 class="post-title">
|
<h1 class="post-title">
|
||||||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
||||||
</h1>
|
</h1>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user