dencold / hasper

a port of Ghost's casper theme for Hugo
MIT License
22 stars 7 forks source link

Clean up footer.html partial #24

Closed dencold closed 7 years ago

dencold commented 8 years ago

Currently the footer partial looks like this:

<footer class="site-footer clearfix">
  {{if ne .Site.Params.hideCopyright true}}
  <section class="copyright">
    <a href="">{{.Site.Title}}</a> {{.Site.Copyright}}
  </section>
  {{end}}

  {{if ne .Site.Params.hideHUGOSupport true}}
  <section class="poweredby">
    Proudly generated by <a class="icon-hugo" href="http://gohugo.io">HUGO</a>, with <a class="icon-theme" href="https://github.com/dencold/hasper">Hasper</a> theme.
  </section>
  {{end}}
</footer>

</div>

<script type="text/javascript" src="{{.Site.BaseURL}}js/jquery.js"></script>
<script type="text/javascript" src="{{.Site.BaseURL}}js/jquery.fitvids.js"></script>
<script type="text/javascript" src="{{.Site.BaseURL}}js/index.js"></script>

{{if .Site.Params.customFooterPartial}}
{{partial .Site.Params.customFooterPartial .}}
{{end}}

</body>
</html>

When this partial is used in templates, it ends up looking something like this:

<!DOCTYPE html>
<html lang="{{.Site.LanguageCode}}">
<head>
  {{partial "head/includes.html" .}}
</head>
<body class="nav-closed">

  {{partial "navigation.html" .}}

 <div class="site-wrapper">

{{$baseurl := .Site.BaseURL}}
{{partial "covers/paging.html" .}}

<main class="content" role="main">
  {{$paginator := .Paginator}}

    {{range $index, $page := $paginator.Pages}}
       {{partial "li.html" .}}
    {{end}}

    {{partial "pagination.html" $paginator}}
</main>

{{partial "footer.html" .}}

Which I am really not a fan of. I like seeing the overall structure of a template and having proper matched closing tags on things like <html> and <body>. What's worse is the <div class="site-wrapper"> depends on a closing </div> tag that is in the footer.html. When you look at that partial, you have no idea what the closing div corresponds to.

Todos:

dencold commented 7 years ago

Closing this issue. We now have #29 to track script calls that was mentioned here.