Skip to content

Instantly share code, notes, and snippets.

@EmielH
Last active October 14, 2018 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmielH/da637a61ccc813adb1be791299623650 to your computer and use it in GitHub Desktop.
Save EmielH/da637a61ccc813adb1be791299623650 to your computer and use it in GitHub Desktop.
Partial "inheritance" - is it possible?
<!--
I would like this to retrieve the partial from the theme.
I would also like this file to be called single-post-info.html so that I do not have to edit single.html, which comes from the theme
-->
{{ partial "single-post-info.html" . }}
<!-- Add my own stuff here -->
<div class="post-info">
<span>{{ i18n "writtenBy" }}</span>
{{- if .Params.Author }}
{{ .Params.Author }}
{{- else }}
{{ .Site.Params.Author }}
{{- end }}
{{- if .PublishDate }}
<br>
<span>{{ i18n "on" }}&nbsp;</span><time datetime="{{ .PublishDate }}">{{ i18n "publishdate" . }}</time>
{{- end }}
</div>
{{ define "main" }}
<main>
<div class="post">
{{ partial "single-post-info.html" . }}
<h1 class="post-title">{{ .Title }}</h1>
<div class="post-line"></div>
{{ .Content }}
</div>
<div class="pagination">
{{- if .Next }}
<a href="{{ .Next.URL }}" class="left arrow">&#8592;</a>
{{- end }}
{{- if .Prev }}
<a href="{{ .Prev.URL }}" class="right arrow">&#8594;</a>
{{- end }}
<a href="#" class="top">Top</a>
</div>
</main>
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment