diff options
Diffstat (limited to 'themes/LoveIt/layouts/posts')
-rw-r--r-- | themes/LoveIt/layouts/posts/rss.xml | 41 | ||||
-rw-r--r-- | themes/LoveIt/layouts/posts/single.html | 101 |
2 files changed, 142 insertions, 0 deletions
diff --git a/themes/LoveIt/layouts/posts/rss.xml b/themes/LoveIt/layouts/posts/rss.xml new file mode 100644 index 0000000..454cdec --- /dev/null +++ b/themes/LoveIt/layouts/posts/rss.xml @@ -0,0 +1,41 @@ +<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> + <channel> + <title> + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} + </title> + <link> + {{- .Permalink -}} + </link> + <description> + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .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> + <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" -}} + </lastBuildDate> + {{- end -}} + <atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" /> + {{- range .Pages | first (.Site.Params.section.rss | default 10) -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} + {{- end -}} + </channel> +</rss> diff --git a/themes/LoveIt/layouts/posts/single.html b/themes/LoveIt/layouts/posts/single.html new file mode 100644 index 0000000..5f856a2 --- /dev/null +++ b/themes/LoveIt/layouts/posts/single.html @@ -0,0 +1,101 @@ +{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}} + +{{- define "content" -}} + {{- $params := .Scratch.Get "params" -}} + + {{- $toc := $params.toc -}} + {{- if eq $toc true -}} + {{- $toc = .Site.Params.page.toc | default dict -}} + {{- else if eq $toc false -}} + {{- $toc = dict "enable" false -}} + {{- end -}} + + {{- /* Auto TOC */ -}} + {{- if ne $toc.enable false -}} + <div class="toc" id="toc-auto"> + <h2 class="toc-title">{{ T "contents" }}</h2> + <div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div> + </div> + {{- end -}} + + <article class="page single"> + {{- /* Title */ -}} + <h1 class="single-title animate__animated animate__flipInX">{{ .Title | emojify }}</h1> + + {{- /* Subtitle */ -}} + {{- with $params.subtitle -}} + <h2 class="single-subtitle">{{ . }}</h2> + {{- end -}} + + {{- /* Meta */ -}} + <div class="post-meta"> + <div class="post-meta-line"> + {{- $author := $params.author | default .Site.Author.name | default (T "author") -}} + {{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}} + <span class="post-author"> + {{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}} + {{- partial "plugin/a.html" $options -}} + </span> + + {{- $categories := slice -}} + {{- range .Params.categories -}} + {{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}} + {{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw" aria-hidden="true"></i>%v</a>` $category.RelPermalink $category.Title) -}} + {{- end -}} + {{- with delimit $categories " " -}} + <span class="post-category"> + {{- dict "Categories" . | T "includedInCategories" | safeHTML -}} + </span> + {{- end -}} + </div> + <div class="post-meta-line"> + {{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}} + <i class="far fa-calendar-alt fa-fw" aria-hidden="true"></i> <time datetime="{{ . }}">{{ . }}</time> + {{- end -}} + <i class="fas fa-pencil-alt fa-fw" aria-hidden="true"></i> {{ T "wordCount" .WordCount }} + <i class="far fa-clock fa-fw" aria-hidden="true"></i> {{ T "readingTime" .ReadingTime }} + {{- $comment := .Scratch.Get "comment" | default dict -}} + {{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}} + <span id="{{ .RelPermalink }}" class="leancloud_visitors" data-flag-title="{{ .Title }}"> + <i class="far fa-eye fa-fw" aria-hidden="true"></i> <span class=leancloud-visitors-count></span> {{ T "views" }} + </span> + {{- end -}} + </div> + </div> + + {{- /* Featured image */ -}} + {{- $image := $params.featuredimage -}} + {{- with .Resources.GetMatch "featured-image" -}} + {{- $image = .RelPermalink -}} + {{- end -}} + {{- with $image -}} + <div class="featured-image"> + {{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/img.html" -}} + </div> + {{- end -}} + + {{- /* Static TOC */ -}} + {{- if ne $toc.enable false -}} + <div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}"> + <div class="details-summary toc-title"> + <span>{{ T "contents" }}</span> + <span><i class="details-icon fas fa-angle-right" aria-hidden="true"></i></span> + </div> + <div class="details-content toc-content" id="toc-content-static"> + {{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + </div> + </div> + {{- end -}} + + {{- /* Content */ -}} + <div class="content" id="content"> + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + </div> + + {{- /* Footer */ -}} + {{- partial "single/footer.html" . -}} + + {{- /* Comment */ -}} + {{- partial "comment.html" . -}} + </article> +{{- end -}} |