fix: Layout and theme
This commit is contained in:
19
layouts/index.html
Normal file
19
layouts/index.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- define "main" }}
|
||||
|
||||
{{- if .Site.Params.homeInfoParams }}
|
||||
<article class="first-entry home-info">
|
||||
<header class="entry-header">
|
||||
<h1>{{ .Site.Params.homeInfoParams.Title | markdownify }}</h1>
|
||||
</header>
|
||||
<div class="entry-content">
|
||||
{{ .Site.Params.homeInfoParams.Content | markdownify }}
|
||||
</div>
|
||||
<footer class="entry-footer">
|
||||
{{- partial "social_icons.html" (dict "align" site.Params.homeInfoParams.AlignSocialIconsTo) }}
|
||||
</footer>
|
||||
</article>
|
||||
{{- end }}
|
||||
|
||||
{{- /* No recent posts/notes - clean home page */ -}}
|
||||
|
||||
{{- end }}{{/* end main */}}
|
||||
@@ -7,22 +7,13 @@
|
||||
{{- end }}
|
||||
</header>
|
||||
|
||||
{{- $pages := .Pages }}
|
||||
|
||||
{{- if .Site.Params.fuseOpts }}
|
||||
<div id="searchResults" class="post-list"></div>
|
||||
{{- end }}
|
||||
|
||||
<ul class="notes-list">
|
||||
{{- range $pages }}
|
||||
{{- range .Pages }}
|
||||
<li class="note-item">
|
||||
<a href="{{ .Permalink }}">
|
||||
<span class="note-title">{{ .Title }}</span>
|
||||
<span class="note-title"># {{ .Title }}</span>
|
||||
<span class="note-date">{{ .Date.Format "Jan 2, 2006" }}</span>
|
||||
</a>
|
||||
{{- if .Summary }}
|
||||
<p class="note-summary">{{ .Summary | plainify | truncate 100 }}</p>
|
||||
{{- end }}
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
|
||||
113
layouts/partials/templates/schema_json.html
Normal file
113
layouts/partials/templates/schema_json.html
Normal file
@@ -0,0 +1,113 @@
|
||||
{{ if .IsHome }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
|
||||
"name": {{ site.Title | jsonify }},
|
||||
"url": {{ site.Home.Permalink | jsonify }},
|
||||
"description": {{ site.Params.description | plainify | truncate 180 | jsonify }},
|
||||
{{- if (eq site.Params.schema.publisherType "Person") }}
|
||||
"image": {{ site.Params.assets.favicon | default "favicon.ico" | absURL | jsonify }},
|
||||
{{- else }}
|
||||
"logo": {{ site.Params.assets.favicon | default "favicon.ico" | absURL | jsonify }},
|
||||
{{- end }}
|
||||
"sameAs": [
|
||||
{{- if site.Params.schema.sameAs }}
|
||||
{{ range $i, $e := site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " | jsonify }}{{ end }}
|
||||
{{- else}}
|
||||
{{ range $i, $e := site.Params.SocialIcons }}{{ if $i }}, {{ end }}{{ trim $e.url " " | jsonify }}{{ end }}
|
||||
{{- end}}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
{{- else if (or .IsPage .IsSection) }}
|
||||
{{/* BreadcrumbList */}}
|
||||
{{- $url := replace .Parent.Permalink ( printf "%s" site.Home.Permalink) "" }}
|
||||
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
|
||||
{{- $bc_list := (split $lang_url "/")}}
|
||||
|
||||
{{- $scratch := newScratch }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [
|
||||
{{- range $index, $element := $bc_list }}
|
||||
|
||||
{{- $scratch.Add "path" (printf "%s/" $element ) | safeJS }}
|
||||
{{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
|
||||
|
||||
{{- if (and ($bc_pg) (gt (len . ) 0))}}
|
||||
{{- if $index }}, {{end }}
|
||||
{
|
||||
"@type": "ListItem",
|
||||
"position": {{ add 1 $index }},
|
||||
"name": {{ $bc_pg.Name | jsonify }},
|
||||
"item": {{ $bc_pg.Permalink | jsonify }}
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
{{- /* self-page addition */ -}}
|
||||
, {
|
||||
"@type": "ListItem",
|
||||
"position": {{ add (len $bc_list) 1 }},
|
||||
"name": {{ .Name | jsonify }},
|
||||
"item": {{ .Permalink | jsonify }}
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
{{- if .IsPage }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"headline": {{ .Title | plainify | jsonify }},
|
||||
"name": {{ .Title | plainify | jsonify }},
|
||||
"description": {{ with .Description | plainify }}{{ . | jsonify }}{{ else }}{{ .Summary | plainify | truncate 150 | jsonify }}{{ end }},
|
||||
"keywords": [
|
||||
{{- if .Params.keywords }}
|
||||
{{ range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e | jsonify }}{{ end }}
|
||||
{{- else }}
|
||||
{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e | jsonify }}{{ end }}
|
||||
{{- end }}
|
||||
],
|
||||
"wordCount": {{ .WordCount }},
|
||||
"inLanguage": {{ .Language.Lang | default "en-us" | jsonify }},
|
||||
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" | jsonify }},
|
||||
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | jsonify }},
|
||||
{{- with (.Params.author | default site.Params.author) }}
|
||||
"author":
|
||||
{{- if (or (eq (printf "%T" .) "[]string") (eq (printf "%T" .) "[]interface {}")) -}}
|
||||
[{{- range $i, $v := . -}}
|
||||
{{- if $i }}, {{end -}}
|
||||
{
|
||||
"@type": "Person",
|
||||
"name": {{ $v | jsonify }}
|
||||
}
|
||||
{{- end }}],
|
||||
{{- else -}}
|
||||
{
|
||||
"@type": "Person",
|
||||
"name": {{ . | jsonify }}
|
||||
},
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": {{ .Permalink | jsonify }}
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
|
||||
"name": {{ site.Title | jsonify }},
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ site.Params.assets.favicon | default "favicon.ico" | absURL | jsonify }}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{{- end }}{{/* .IsPage end */}}
|
||||
|
||||
{{- end -}}
|
||||
24
layouts/posts/list.html
Normal file
24
layouts/posts/list.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- define "main" }}
|
||||
|
||||
<header class="page-header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{- if .Description }}
|
||||
<div class="post-description">{{ .Description }}</div>
|
||||
{{- end }}
|
||||
</header>
|
||||
|
||||
<ul class="posts-list">
|
||||
{{- range .Pages }}
|
||||
<li class="post-item">
|
||||
<a href="{{ .Permalink }}">
|
||||
<span class="post-title"># {{ .Title }}</span>
|
||||
<span class="post-date">{{ .Date.Format "Jan 2, 2006" }}</span>
|
||||
</a>
|
||||
{{- if .Summary }}
|
||||
<p class="post-summary">{{ .Summary | plainify | truncate 150 }}</p>
|
||||
{{- end }}
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
|
||||
{{- end }}{{/* end main */}}
|
||||
Reference in New Issue
Block a user