Hi there
I am trying to create a customized template to render the homepage of a website. I am using the FUTURE2021 theme, and for all the other pages except the homepage, I want to use the pre-existing templates that came with the theme.
Online, I have read that I basically have to use TWIG syntax together with the flat HTML (index.html) that I currently have in order to make the template of the homepage.
Knowing this, I got started with adding the TWIG into my HTML (index.html.twig). My issue came when trying to link the actual Homepage (which initially is in the âdefaultâ template) to the index.html.twig template.
The things that I have tried without results:
- Adding the index.html.twig file to the grav-admin/user/themes/future2021/templates/ ; then look for the template in the Dashboard to assign it as a template to the âhomeâ.
1.1 Result: the template âindexâ does not show up in the grav GUI dropdown menu. - Adding the index.html.twig file to the grav-admin/user/themes/future2021/templates/ ; then change in the folder âpagesâ, go to â01.homeâ and change the md file to âindex.mdâ
2.1 Result: the page renders as if it were still rendering the âdefault.mdâ. - Adding the index.html.twig file to the grav-admin/user/themes/future2021/templates/ ; then, since I saw that the path on the browser changed accordingly to the name of the content folder (ex: 01.home), I also tried changing the name of â01.homeâ to â01.indexâ. This is a bit silly maybe but I had to try.
3.1 Result: Did not work, the page renders as if it were still rendering the âdefault.mdâ & if I point the browser to http://localhost:8000/index, it shows âerror page does not existâ
In the documentation, in âcookbook > Migrate an HTML theme to Gravâ, I see the process described for creating your own theme, which is not my case because I do not want to create a blank theme, but in any case I followed the logic there for the template process and canât make it to work.
I was thinking that maybe it does not render because of mistakes in my TWIG code, but seems unlikely that this is the case because how would then people customize if they cannot see whatâs actually doing the code?
I want to link the my custom template to the page because I am learning TWIG and I need to see what am I coding right and what wrong. I need the visual support of the page being rendered to learn how to do it.
Can this be done? Maybe a theme can only be used with its own templates and non else? Or am I missing a thing? (I think so⌠but canât find any more clues of what I am missing onlineâŚ)
Thanks a lot in advance just for reading this long question!