Hello,
I’m new to Grav. It seems very interesting. But… I don’t understand how it works. I’ve installed some plugins, but I don’t know how to use them.
Forms for example, I don’t know how to make a simple contact form.
I look at the doc, but I can’t create a form…
Or for the cookies.
Someone to help me begin with it please ?
Thanks
ANDRE Ani
Plugins in Grav mostly work through Templates or shortcuts.
or special markdown Files with extra header (=frontmatter).
As for contact Forms, take a look at the forms dokumentation - this should get you started.
I don’t understand what is frontmatter… I’ve looked at the doc for Forms, but Idon’t know where to put the example code… I’ve nothing on the page.
frontmatter is the head of your markdown page, all between
'—
title:XYZ …
and
'—
the format for frontmatter is yaml
just copy this text
and save it as form.md in your form page folder.
I don’t know how I do it but I have a form contact now In the page editor, I have just modified the template for form and the form appears.
Ok for frontmatter. But I don’t understand it’s utility and difference with the content of the page.
For some plugins, we have to modify the template (for cookies for example). Is it in frontmatter or in the content ?
page content is usually just what you write AFTER the frontmatter section.
you see it just as text on your website.
and no, templates are not frontmatter, they are a mix of html and twig template language, they are to define what will be shown where in a page.
twig variables are often variables which hold content defined by a plugin.
that’s the way plugins work through templates.
the other way is through frontmatter, and another one is through shortcodes.
usually, you can find in the plugin documentation, which mehtod can be used (one or more of the above…)
Thanks a lot for your explanations It’s more clear now.
But I asked me, why all these methods ? It’s not simple.
not so simple, at a first look, agreed - but it gives a lot of flexibility.
once you get used to it, it is easy, much more than having to click around in more or less inconsistent backend UI’s (like the Wordpress plugin mess).
1 Like
Again a question for another plugin, please. Because there’s something I don’t really understand. For this plugin : https://github.com/kwachu96/grav-plugin-cookies-notice it says to add this code {{ cookiesnotice_markup }}
before the body close tag. Is it in expert mode when editing a page, in the frontmaster ? Or in the content ? Or directly, with an external editor in the twig file directly ? I don’t understand…
Ok, I found. It’s directly in the twig template. Is there a more simple way to do this ? Impossible from the editor in the admin ?