Use block templates [1] for all of the full-page templates such as index.html, _default/list.html, etc. This reduces code duplicated between them. Also, move the code in partials/page.html and partials/post.html to page/single.html and post/single.html respectively. With block templates the contents of the partials is almost exactly the same as the contents of the single page templates, and having dedicated single-page templates for the content types means that we can get rid of the if/then/else logic in _default/single.html. This also gets rid of an excess container div; the duplication of the divs was being obscured by the way _default/single.html was interacting with the partials. (This is the same duplicated div as in pull request #51 found by @1138-4EB.) [1] https://gohugo.io/templates/blocks/
17 lines
520 B
HTML
17 lines
520 B
HTML
{{ define "main" }}
|
|
<div class="container" role="main">
|
|
<div class="row">
|
|
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
|
{{ .Content }}
|
|
{{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (.Site.Params.comments)) }}
|
|
{{ if .Site.DisqusShortname }}
|
|
<div class="disqus-comments">
|
|
{{ template "_internal/disqus.html" . }}
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
|