I can’t understand how to edit a page in twig!
if I create a page with grav, it creates a.md file for me, I would then like to create the corresponding file in twig, so as to give it the style changes.
@lucapu88, Have you read the documentation, chapters ‘Basic’, ‘Content’ and ‘Themes’?
- Twig files are mostly provided by the theme you are using. If, for example, you are using Quark (the default theme), the Twig templates will be located in
/user/themes/quark/templates/...
- The name of the page (*.md) determines the Twig file to be used:
-
default.md
->/user/themes/quark/templates/default.html.twig
-
blog.md
->/user/themes/quark/templates/blog.html.twig
-
Before making any change to the Twig files, please create an inherited theme. If not, all changes will be lost once the theme gets updated.
if I hadn’t read the documentation I wouldn’t be here!
then, if I add a page from grav, it adds the same page in twig with file.md.
then I want to change the style of this page in twig, since obviously you can’t markdown it.
how can I do???
A page uses a Twig template for it’s HTML structure which defines the page layout.
Styling on the other hand is done via CSS. The Quark theme already has a place for custom styles: /user/themes/quark/css/custom.css
.
To prevent loosing edits made to that custom.css
file when updating the theme use a inherited theme as @anon76427325 already suggested.
Look at existing pages and play with the templates and CSS. Then the documentation will make more sense.