mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-12-22 04:13:17 -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 }}
|
||||
<a href="#{{ .Anchor | safeURL }}">
|
||||
<span class="section-header-link">
|
||||
{{ partial "icon.html" "link" }}
|
||||
{{ partialCached "icon.html" "link" "link" }}
|
||||
</span>
|
||||
</a>
|
||||
</h{{ .Level }}>
|
||||
|
@ -1,20 +1,11 @@
|
||||
{{ partial "credit.html" }}
|
||||
{{ partialCached "credit.html" . }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{{- partial "head.html" . -}}
|
||||
|
||||
<body>
|
||||
<div class="top">
|
||||
<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>
|
||||
{{ partialCached "top.html" . }}
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
@ -1,23 +1,23 @@
|
||||
{{ define "main" }}
|
||||
{{ if or (eq .Kind "term") (eq .Kind "taxonomy") }}
|
||||
<h1>
|
||||
{{ partial "icon.html" "filter" }}
|
||||
{{ partialCached "icon.html" "filter" "filter" }}
|
||||
Filtering for "{{ .Title }}"
|
||||
{{ if eq .Kind "term" }}
|
||||
<span class="rss-link">
|
||||
{{ with .OutputFormats.Get "rss" }}
|
||||
<a href="{{ .Permalink }}">{{ partial "icon.html" "rss" }}</a>
|
||||
<a href="{{ .Permalink }}">{{ partialCached "icon.html" "rss" "rss" }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
</h1>
|
||||
{{ else }}
|
||||
<h1>
|
||||
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
|
||||
{{ with .Params.icon }}{{ partialCached "icon.html" . . }}{{ end }}
|
||||
{{ .Title | markdownify }}
|
||||
<span class="rss-link">
|
||||
{{ with .OutputFormats.Get "rss" }}
|
||||
<a href="{{ .Permalink }}">{{ partial "icon.html" "rss" }}</a>
|
||||
<a href="{{ .Permalink }}">{{ partialCached "icon.html" "rss" "rss" }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
</h1>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="post-title">
|
||||
<h1>
|
||||
{{ .Title | markdownify }}
|
||||
{{ if .Draft }}{{ partial "icon.html" "edit" }}{{ end }}
|
||||
{{ if .Draft }}{{ partialCached "icon.html" "edit" "edit" }}{{ end }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<div class="post">
|
||||
<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>
|
||||
{{ if .Draft }}{{ partial "icon.html" "edit" }}{{ end }}
|
||||
{{ if .Draft }}{{ partialCached "icon.html" "edit" "edit" }}{{ end }}
|
||||
</h2>
|
||||
|
||||
{{ partial "post-metadata.html" . }}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "calendar" }}
|
||||
{{ partialCached "icon.html" "calendar" "calendar" }}
|
||||
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
|
||||
{{ .Date.Format "January 2, 2006" }}
|
||||
</time>
|
||||
@ -11,7 +11,7 @@
|
||||
{{ if not .Site.Params.repoURL }}
|
||||
{{ if ne .Lastmod .Date }}
|
||||
<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>
|
||||
{{ .Lastmod.Format "January 2, 2006" }}
|
||||
</time>
|
||||
@ -22,14 +22,14 @@
|
||||
|
||||
{{ if .Site.Params.wordcount }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "type" }}
|
||||
{{ partialCached "icon.html" "type" "type" }}
|
||||
{{ .WordCount }} words
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.readingtime }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "clock" }}
|
||||
{{ partialCached "icon.html" "clock" "clock" }}
|
||||
{{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
@ -37,7 +37,7 @@
|
||||
{{ if .Site.Params.repoURL }}
|
||||
{{ with .GitInfo }}
|
||||
<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 }}">
|
||||
<code>{{ .AbbreviatedHash }}</code>
|
||||
</a>
|
||||
@ -48,7 +48,7 @@
|
||||
<div class="tags">
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "tag" }}
|
||||
{{ partialCached "icon.html" "tag" "tag" }}
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</span>
|
||||
{{ 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