diff options
author | Emiel Hollander <EmielH@users.noreply.github.com> | 2018-10-14 11:39:11 +0300 |
---|---|---|
committer | Emiel Hollander <EmielH@users.noreply.github.com> | 2018-10-14 11:39:11 +0300 |
commit | 1d6a21e02c17913c74c36ce4a5c6a02f5f17b071 (patch) | |
tree | e853521f0037245022725e90a40ba12fc47dadb2 /layouts | |
parent | b22abdc7f43ef26a63e28e67c7045d73b1ec6a8a (diff) |
Split some templates into partials
This makes it easier to change or override parts of the theme on your
site without losing updates to the theme.
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 14 | ||||
-rw-r--r-- | layouts/partials/header-menu.html | 4 | ||||
-rw-r--r-- | layouts/partials/header.html | 11 | ||||
-rw-r--r-- | layouts/partials/single-post-info.html | 13 |
4 files changed, 22 insertions, 20 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9134f96..1968456 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,19 +2,7 @@ <main> <div class="post"> - <div class="post-info"> - <span>{{ i18n "writtenBy" }}</span> - {{- if .Params.Author }} - {{ .Params.Author }} - {{- else }} - {{ .Site.Params.Author }} - {{- end }} - - {{- if .PublishDate }} - <br> - <span>{{ i18n "on" }} </span><time datetime="{{ .PublishDate }}">{{ i18n "publishdate" . }}</time> - {{- end }} - </div> + {{ partial "single-post-info.html" . }} <h1 class="post-title">{{ .Title }}</h1> <div class="post-line"></div> diff --git a/layouts/partials/header-menu.html b/layouts/partials/header-menu.html new file mode 100644 index 0000000..f769487 --- /dev/null +++ b/layouts/partials/header-menu.html @@ -0,0 +1,4 @@ +<ul> + <li><a href="{{ .Site.BaseURL }}about">{{ i18n "about" }}</a></li> + <li><a href="{{ .Site.BaseURL }}">{{ i18n "posts" }}</a></li> +</ul>
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 6f00f62..eb22285 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -6,12 +6,9 @@ <body> <nav class="nav"> <div class="nav-container"> - <a href="{{ .Site.BaseURL }}/"> - <h2 class="nav-title">{{ .Site.Title }}</h2> - </a> - <ul> - <li><a href="{{ .Site.BaseURL }}about">{{ i18n "about" }}</a></li> - <li><a href="{{ .Site.BaseURL }}">{{ i18n "posts" }}</a></li> - </ul> + <a href="{{ .Site.BaseURL }}/"> + <h2 class="nav-title">{{ .Site.Title }}</h2> + </a> + {{ partial "header-menu.html" . }} </div> </nav>
\ No newline at end of file diff --git a/layouts/partials/single-post-info.html b/layouts/partials/single-post-info.html new file mode 100644 index 0000000..d4a4353 --- /dev/null +++ b/layouts/partials/single-post-info.html @@ -0,0 +1,13 @@ +<div class="post-info"> + <span>{{ i18n "writtenBy" }}</span> + {{- if .Params.Author }} + {{ .Params.Author }} + {{- else }} + {{ .Site.Params.Author }} + {{- end }} + + {{- if .PublishDate }} + <br> + <span>{{ i18n "on" }} </span><time datetime="{{ .PublishDate }}">{{ i18n "publishdate" . }}</time> + {{- end }} +</div>
\ No newline at end of file |