mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-21 07:46:30 -05:00
Fixed default layout and added tag layout for timestamps
This commit is contained in:
parent
4cd68c5fbf
commit
84b4d3d344
7 changed files with 126 additions and 9 deletions
|
@ -1,9 +0,0 @@
|
|||
{{ define "main"}}
|
||||
<h1 class='title'>{{ .Title }}</h1>
|
||||
{{ partial "header.html" . }}
|
||||
<!-- content -->
|
||||
<div id="contentBody">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
7
layouts/tags/baseof.html
Normal file
7
layouts/tags/baseof.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{ partial "head.html" . }}
|
||||
<body>
|
||||
{{ block "main" . }}{{ end }}
|
||||
</body>
|
||||
</html>
|
39
layouts/tags/list.html
Normal file
39
layouts/tags/list.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
{{ define "main"}}
|
||||
<h1 class='title'>{{ .Title }}</h1>
|
||||
{{ partial "header.html" . }}
|
||||
<!-- search box -->
|
||||
<div id="searchBox">
|
||||
<input type="text" id="searchBoxInput" placeholder="Search..." />
|
||||
<img id="searchBoxIcon" src="{{ .Site.BaseURL }}/img/search.png" />
|
||||
</div>
|
||||
<!-- search results -->
|
||||
<div id="searchResults"></div>
|
||||
<!-- tags -->
|
||||
<div id="tags">
|
||||
<ul>
|
||||
{{ range .Site.Taxonomies.tags.ByCount }}
|
||||
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }} ({{ .Count }})</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
<!-- contents -->
|
||||
<div id="contentsList">
|
||||
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}}
|
||||
{{ range $index, $value := .Pages.GroupByDate $listPageDateFormat }}
|
||||
{{ if (ne $index 0) }}
|
||||
<hr class="separator">
|
||||
{{ end }}
|
||||
<p class="date">{{ .Key }}</p>
|
||||
{{ range .Pages }}
|
||||
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ $jquery := resources.Get "js/jquery-3.3.1.min.js" }}
|
||||
{{ $mark := resources.Get "js/jquery.mark.es6.min.js" }}
|
||||
{{ $lunr := resources.Get "js/lunr.js" }}
|
||||
{{ $search := resources.Get "js/search.js" }}
|
||||
{{ $js := slice $jquery $mark $lunr $search | resources.Concat "bundle.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script src="{{ $js.Permalink }}"></script>
|
||||
{{ end }}
|
10
layouts/tags/list.json
Normal file
10
layouts/tags/list.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
[{{ range $index, $page := .Pages }}{{ if ne $index 0 }},{{ end }}
|
||||
{
|
||||
"ref": "{{ $page.Permalink }}",
|
||||
"title": {{ $page.Title | jsonify }},
|
||||
"section": "{{ $page.Section }}",
|
||||
"tags": {{ $page.Params.tags | jsonify }},
|
||||
"date" : {{ $page.Date.Format "2006.01.02" | jsonify }},
|
||||
"body": {{ $page.Plain | jsonify }}
|
||||
}
|
||||
{{ end }}]
|
34
layouts/tags/rss.xml
Normal file
34
layouts/tags/rss.xml
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := $pctx.RegularPages -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{ range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
23
layouts/tags/single.html
Normal file
23
layouts/tags/single.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{ define "main"}}
|
||||
<h1 class='title'>{{ .Title }}</h1>
|
||||
{{ partial "header.html" . }}
|
||||
<!-- date -->
|
||||
{{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}}
|
||||
<p class="date">{{ .Date.Format $singlePageDateFormat }}</p>
|
||||
<!-- tags -->
|
||||
<div id="tags">
|
||||
<ul>
|
||||
{{ range .Param "tags" }}
|
||||
{{ $name := . }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" ($name | urlize)) }}
|
||||
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
<!-- content -->
|
||||
<div id="contentBody">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
13
layouts/tags/terms.html
Normal file
13
layouts/tags/terms.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{ define "main"}}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ partial "header.html" . }}
|
||||
<!-- tags -->
|
||||
<div id="tags">
|
||||
<ul>
|
||||
{{ range .Site.Taxonomies.tags.ByCount }}
|
||||
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }} ({{ .Count }})</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
Loading…
Reference in a new issue