Skip to content

How do I add a form at the end of each post? #250

Answered by kdkasad
Jarmos-san asked this question in Q&A
Discussion options

You must be logged in to vote

Option 1

In single.html, you could try something like the following:

{{- if (eq .Type "posts") -}}
{{ partial "form.html" . }}
{{/* or include HTML for the form here */}}
{{- end -}}

Option 2

Or, what I would recommend, is using a custom param to handle this:

{{- if .Param "enableForm" -}}
{{ partial "form.html" . }}
{{/* or include HTML for the form here */}}
{{- end -}}

Then you'd add the following to each page's front matter:

enableForm: true

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Jarmos-san
Comment options

@kdkasad
Comment options

@Jarmos-san
Comment options

Answer selected by Jarmos-san
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants