mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-11-17 13:25:57 -06:00
Add caching to some partials that don't change much
This commit is contained in:
parent
9ff5314bc0
commit
03834fb1ba
@ -2,7 +2,7 @@
|
|||||||
{{ .Text | safeHTML }}
|
{{ .Text | safeHTML }}
|
||||||
<a href="#{{ .Anchor | safeURL }}">
|
<a href="#{{ .Anchor | safeURL }}">
|
||||||
<span class="section-header-link">
|
<span class="section-header-link">
|
||||||
{{ partial "icon.html" "link" }}
|
{{ partialCached "icon.html" "link" "link" }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
||||||
|
@ -1,20 +1,11 @@
|
|||||||
{{ partial "credit.html" }}
|
{{ partialCached "credit.html" . }}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
{{- partial "head.html" . -}}
|
{{- partial "head.html" . -}}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<h2 class="header">
|
{{ partialCached "top.html" . }}
|
||||||
<a href="{{ "/" | relURL }}">{{ .Site.Title | markdownify }}</a>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<nav id="navbar">
|
|
||||||
<a class="navbar-item" href="{{ "/" | relURL }}">Home</a>
|
|
||||||
{{ range .Site.Menus.main }}
|
|
||||||
<a class="navbar-item" href="{{ .URL }}">{{ .Name }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{ if or (eq .Kind "term") (eq .Kind "taxonomy") }}
|
{{ if or (eq .Kind "term") (eq .Kind "taxonomy") }}
|
||||||
<h1>
|
<h1>
|
||||||
{{ partial "icon.html" "filter" }}
|
{{ partialCached "icon.html" "filter" "filter" }}
|
||||||
Filtering for "{{ .Title }}"
|
Filtering for "{{ .Title }}"
|
||||||
{{ if eq .Kind "term" }}
|
{{ if eq .Kind "term" }}
|
||||||
<span class="rss-link">
|
<span class="rss-link">
|
||||||
{{ with .OutputFormats.Get "rss" }}
|
{{ with .OutputFormats.Get "rss" }}
|
||||||
<a href="{{ .Permalink }}">{{ partial "icon.html" "rss" }}</a>
|
<a href="{{ .Permalink }}">{{ partialCached "icon.html" "rss" "rss" }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</h1>
|
</h1>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<h1>
|
<h1>
|
||||||
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
|
{{ with .Params.icon }}{{ partialCached "icon.html" . . }}{{ end }}
|
||||||
{{ .Title | markdownify }}
|
{{ .Title | markdownify }}
|
||||||
<span class="rss-link">
|
<span class="rss-link">
|
||||||
{{ with .OutputFormats.Get "rss" }}
|
{{ with .OutputFormats.Get "rss" }}
|
||||||
<a href="{{ .Permalink }}">{{ partial "icon.html" "rss" }}</a>
|
<a href="{{ .Permalink }}">{{ partialCached "icon.html" "rss" "rss" }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="post-title">
|
<div class="post-title">
|
||||||
<h1>
|
<h1>
|
||||||
{{ .Title | markdownify }}
|
{{ .Title | markdownify }}
|
||||||
{{ if .Draft }}{{ partial "icon.html" "edit" }}{{ end }}
|
{{ if .Draft }}{{ partialCached "icon.html" "edit" "edit" }}{{ end }}
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<div class="post">
|
<div class="post">
|
||||||
<h2 class="post-title">
|
<h2 class="post-title">
|
||||||
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
|
{{ with .Parent.Params.icon }}{{ partialCached "icon.html" . . }}{{ end }}
|
||||||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
||||||
{{ if .Draft }}{{ partial "icon.html" "edit" }}{{ end }}
|
{{ if .Draft }}{{ partialCached "icon.html" "edit" "edit" }}{{ end }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{{ partial "post-metadata.html" . }}
|
{{ partial "post-metadata.html" . }}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="post-metadata">
|
<div class="post-metadata">
|
||||||
{{ if .Date }}
|
{{ if .Date }}
|
||||||
<span class="post-meta-item">
|
<span class="post-meta-item">
|
||||||
{{ partial "icon.html" "calendar" }}
|
{{ partialCached "icon.html" "calendar" "calendar" }}
|
||||||
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
|
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
|
||||||
{{ .Date.Format "January 2, 2006" }}
|
{{ .Date.Format "January 2, 2006" }}
|
||||||
</time>
|
</time>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
{{ if not .Site.Params.repoURL }}
|
{{ if not .Site.Params.repoURL }}
|
||||||
{{ if ne .Lastmod .Date }}
|
{{ if ne .Lastmod .Date }}
|
||||||
<span class="post-meta-item">
|
<span class="post-meta-item">
|
||||||
{{ partial "icon.html" "edit-2" }}
|
{{ partialCached "icon.html" "edit-2" "edit-2" }}
|
||||||
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
|
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
|
||||||
{{ .Lastmod.Format "January 2, 2006" }}
|
{{ .Lastmod.Format "January 2, 2006" }}
|
||||||
</time>
|
</time>
|
||||||
@ -22,14 +22,14 @@
|
|||||||
|
|
||||||
{{ if .Site.Params.wordcount }}
|
{{ if .Site.Params.wordcount }}
|
||||||
<span class="post-meta-item">
|
<span class="post-meta-item">
|
||||||
{{ partial "icon.html" "type" }}
|
{{ partialCached "icon.html" "type" "type" }}
|
||||||
{{ .WordCount }} words
|
{{ .WordCount }} words
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Site.Params.readingtime }}
|
{{ if .Site.Params.readingtime }}
|
||||||
<span class="post-meta-item">
|
<span class="post-meta-item">
|
||||||
{{ partial "icon.html" "clock" }}
|
{{ partialCached "icon.html" "clock" "clock" }}
|
||||||
{{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }}
|
{{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@ -37,7 +37,7 @@
|
|||||||
{{ if .Site.Params.repoURL }}
|
{{ if .Site.Params.repoURL }}
|
||||||
{{ with .GitInfo }}
|
{{ with .GitInfo }}
|
||||||
<span class="post-meta-item">
|
<span class="post-meta-item">
|
||||||
{{ partial "icon.html" "git-commit" }}
|
{{ partialCached "icon.html" "git-commit" "git-commit" }}
|
||||||
<a href="{{ (printf "%s/commit/%s" $.Site.Params.repoURL .Hash) | absURL }}">
|
<a href="{{ (printf "%s/commit/%s" $.Site.Params.repoURL .Hash) | absURL }}">
|
||||||
<code>{{ .AbbreviatedHash }}</code>
|
<code>{{ .AbbreviatedHash }}</code>
|
||||||
</a>
|
</a>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<div class="tags">
|
<div class="tags">
|
||||||
{{ range (.GetTerms "tags") }}
|
{{ range (.GetTerms "tags") }}
|
||||||
<span class="post-meta-item">
|
<span class="post-meta-item">
|
||||||
{{ partial "icon.html" "tag" }}
|
{{ partialCached "icon.html" "tag" "tag" }}
|
||||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
10
layouts/partials/top.html
Normal file
10
layouts/partials/top.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<h2 class="header">
|
||||||
|
<a href="{{ "/" | relURL }}">{{ .Site.Title | markdownify }}</a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<nav id="navbar">
|
||||||
|
<a class="navbar-item" href="{{ "/" | relURL }}">Home</a>
|
||||||
|
{{ range .Site.Menus.main }}
|
||||||
|
<a class="navbar-item" href="{{ .URL }}">{{ .Name }}</a>
|
||||||
|
{{ end }}
|
||||||
|
</nav>
|
Loading…
Reference in New Issue
Block a user