So I am migrating to Grav. At my current website I just have a static HTML homepage with some external CSS/JS and I want to migrate do Grav as I will be adding a lot of content after “/” in URL (making a news site). I know I can replicate my homepage in Grav, but I believe it will take me a while to do it correctly due to .twig/templates/new naming/calling files structure.
So I thought that for now, I will just move my homepage in HML and external CSS/JS into root along with Grav but not sure will that all work together as Grav by default will try to call it’s own homepage?
What will be the quickest/easiest way to achieve it without me actually trying to recreate my homepage inside Grav platform?
copy your index.html into a file called index.html.twig and put that in the templates/ folder of your theme. Then just create a simple 01.home/index.md file (this will in turn use index.html.twig to render itself. You don’t need to put much in this file, maybe just:
- - -
title: Home
- - -
Then makes sure you set the homepage in system.yaml to point to 01.home.
That’s the quickest way to get your homepage into Grav. I would recommend pulling out the ‘core’ of your site design into a templates/partials/base.html.twig and then just ‘extending’ it in index.html.twig, then you can move your homepage layout/content into Grav pages so it’s easier to maintain going forward.
Take a look at the default Antimatter theme to see how these things are done.
@rhukster Understood. What about all external files I use for this static html site (CSS/JS and images/svg graphics)? Where should I put them and do I need to change the way I call them?
well you should put them in your theme’s CSS and JS folders… you might need to update paths in your index.html.twig file to point to them correct… again, look at Antimatter for best practices on this.