Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template bug? #113

Open
brenthuisman opened this issue Feb 9, 2021 · 3 comments
Open

Template bug? #113

brenthuisman opened this issue Feb 9, 2021 · 3 comments

Comments

@brenthuisman
Copy link
Contributor

brenthuisman commented Feb 9, 2021

I'm having a weird problem where, only upon first generation, the first child page in a loop in apparently processed by the wrong template, see here an example. Header and footer are added in the "full" template, but should not be added for the page child, and isn't for all but the first child and the first time. (If I regenerate (delete output of this particular page first) then it is correctly generated.) If I remove the entire output dir, and generate, the problem comes back. This is extra unfortunate, because I generate the site on an external service (Netlify), so it starts from scratch every time.

blog.html has:

{{ range (.Site.Pages.Children "blog/").Slice 0 5 -}}
<article>
  <h2><a href="{{ $.Rel .Url }}">{{ .Title }}</a></h2>
  <p>
    {{ template "date" .Date }}
    {{ range $i, $t := .Tags }}{{if $i}},{{end}}
    <a href="/archive/#{{ $t }}"><b>{{ $t }}</b></a>{{ end }}
  </p>

{{ markdown .Content }}
</article>
{{- end }}
<nav class="pagination">
  Read more in the <a href="/archive/">archive</a>.
</nav>

The relevant config:

blog.html: blog/*.md
	yaml
	directorify
	inner-template
	template full
	relativize

Any idea what's going on?

@piranha
Copy link
Owner

piranha commented Feb 9, 2021

Hmmm... Not from the top of my head. Is your site/sources of your site public? Or maybe you could try reproducing the problem with a smaller setup, so we can narrow that down to something in sources?

@brenthuisman
Copy link
Contributor Author

Sure! The sources are here. The only place I see this occur is /blog.html

@brenthuisman
Copy link
Contributor Author

I tried reordering blog/* and blog.html in case somehow sometimes blog.html was picking up on already processed and rendered .Content, but that didn't help.

Changing {{ markdown .Content }} for {{ markdown .Raw }} produces the correct output. But I don't really understand why, you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants