Remove partial from specific pages

Hi
I know how to apply a partial to a specific page or post only in the basehml file but struggle to find out how to exclude a partial for a specific page.

Exemple : how to remove the footer partial only in the 404 page?

1 Like
  • you can have a variable in frontmatter’s pages : exclude = true
  • and test this in your partial
{{if .Params.exclude}}
do stuff
{{end}}

for the 404 you can change the logic in the 404 template

[EDIT] typo. Add .Params

Thanks for your answer. I saw this logic but the main issue is the “do stuff”. What I want Is to remove the header. How you would code this?

Here is how I would go about it:

{{ with .Params.exclude }}
<-- no header --->
{{ else }}
<--- header --->
{{ end }}