nish
1
I need some idea on how I can include raw HTML into a contact page MD without having the following in my config.
[markup.goldmark.renderer]
unsafe= true
Hugo 0.60.0 display when it comes to HTML codes in markup pages…
The contact page has the HTML form code which has fields like name, subject, email, a message with a submit button.
Thanks in advance and any ideas welcome.
Option 1
Create a shortcode which contains the form markup in /layouts/shortcodes/my-form.html
.
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
Then insert the shortcode into your markdown file where needed.
{{< my-form >}}
Option 2
Create a generic shortcode for inserting raw HTML in layouts/shortcodes/rawhtml
.
{{ .Inner }}
Then insert the shortcode into your markdown file where needed.
{{< rawhtml >}}
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
{{< /rawhtml >}}
1 Like
nish
3
Thank you so much, worked perfectly. I will be using both the Options for different purposes.
system
Closed
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.