Hugo Forms PHP
Wanna add some simple forms and process the Content with PHP ?
Add RawHTML Template
if not yet done
mkdir layouts/shortcodes/
cat << 'EOF' > layouts/shortcodes/rawhtml.html
<!-- raw html -->
{{.Inner}}
EOF
Create Script
cat << 'EOF' > static/welcome.php
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
EOF
Create new Post and add rawhtml
without " " between { and {
hugo new content/post/rawtest.md
vim content/post/rawtest.md
{ {<rawhtml>} }
<form action="/welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
{ {</rawhtml>} }
Example
Just a small Form Example