<footer class="footer">
    <!-- Option for user to inject custom html -->
    {{ if .Site.Params.CustomFooterHTML }}
    {{ .Site.Params.CustomFooterHTML | safeHTML }}
    {{ end }}

    {{ .Scratch.Set "footerText" "" }}

    {{ if (.Site.Params.Footer) }}

        {{ if and (eq .Kind "page") (.Date) }}
            {{ .Scratch.Add "footerText" (.Date | time.Format "2006") }}
        {{ else }}
            {{ .Scratch.Add "footerText" (time.Now | time.Format "2006") }}
        {{ end }}

        {{ if and (eq .Kind "page") (.Lastmod) (gt (time.Format "2006" .Lastmod) (time.Format "2006" .Date)) }}
            {{ .Scratch.Add "footerText" "-" }}
            {{ .Scratch.Add "footerText" (.Lastmod | time.Format "2006") }}
        {{ end }}

        {{ .Scratch.Add "footerText" " " }}
        {{ .Scratch.Add "footerText" .Site.Params.Footer }}

        {{ if and (eq .Kind "page") (.Site.Copyright) }}
            {{ .Scratch.Add "footerText" " " }}
            {{ .Scratch.Add "footerText" .Site.Copyright }}
        {{ end }}

    {{ end }}

    {{ if (gt (.Scratch.Get "footerText" | len) 0) }}
        <span>&copy; {{ .Scratch.Get "footerText" | markdownify }}</span>
    {{ end }}

    <span>
        Made with &#10084;&#65039; using <a target="_blank" href="https://github.com/gokarna-theme/gokarna-hugo">Gokarna</a>
    </span>
</footer>
