Many years ago I made my personal page on Drupal 7, as soon as Drupal 8 was released I have upgraded to this version. My personal site is just a page with my contacts and my blog.
In truth, I do not always have enough time to write posts to my blog, as well as keep the core and modules up to date. Some times between the huge projects I have a frame to share my experience and to make some support tasks and improvements.
So more than 99% of its life my personal site works as a simple static HTML site.
Does it make sense to use Drupal as a backend?
Let’s imagine the site is static at any time except the time when I want to edit it…
And it’s possible with Tome. It’s Drupal 8 module. You can get more information on the official site tome.fyi.
Let me show you my personal site abzats.com. It’s a static HTML site. I don’t have the permanent version of this site either hosted somewhere or locally. But I have a private repository of my Drupal site with configurations and content in flat files.
Tome module allows exporting configurations in .yml files and content in .json files as well as install Drupal with those files without operating with the DataBase dump.
I have decided to put some changes on the site. I need to get the site locally, log in Drupal admin, make changes and generate a new version of my static site. That’s it.
Cloning the site:
$ git clone email@example.com:vasilyyaremchuk/personal.git
It’s my private repository, that I have forked from https://github.com/drupal-tome/netlify-template
Coming to the folder:
$ cd personal
If you’ve taken a look at https://github.com/drupal-tome/netlify-template you could find that there is no core folder there. You have to run
$ composer install
to get all necessary dependencies.
Install the site with drush:
$ drush tome:install
Run a local server with drush:
$ drush runserver
Make some changes in the admin area. A new password to login in admin provided after the previous action.
If all changes were done, we can stop the server and generate a static site:
$ drush tome:static –uri=http://abzats.com/
Attention! Don’t forget to set the basic URL of your production site, otherwise, you can get incorrect links that point to your local environment in some places of the static site.
Now you have a new static version of the site and you can deploy it on your hosting.
Don’t forget to update the repository with those changes:
$ git status
You can see that one file with content is changed. Let me commit those changes:
$ git add .
$ git commit -m “content changes”
$ git push
Finally, you can delete the local Drupal 8 site:
$ cd ..
$ rm -R personal