Hi,
I need to have the same form in all items of a blog. I could do that by setting the form in frontmatter for every item. Or I could use a frontmatter.yaml file in each item folder. I wonder if there is not an easier way to do this, like all blog items share the same frontmatter.yaml. Placing this in the blog folder does not work...
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
Solved by pamtbaau View solution
@TonHaarmans, Maybe the following section in the Forms documentation might provide what you need: Displaying Forms From Twig
Using this method, you can choose a specific name of a form to display. You can even provide the name of a form defined in other pages. As long as all your form names are unique throughout your site, Grav will find and render the correct form!
When Including snippet {% include "forms/form.html.twig" with { form: forms('myform') } %} in item.html.twig , every blog item will contain the same form.
The form definition can be created in a page which is not shown. Eg. /pages/myform/form.md
I had to read that a few times before I got it. Will try that out, thanks!!!
Works like a charm!!!
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 2 | 51 | 7 hours ago | ||
| 2 | 58 | 10 hours ago | ||
| 1 | 30 | 11 hours ago | ||
| 2 | 63 | 5 days ago | ||
| 2 | 55 | 5 days ago |