Creating a Static Drupal Site on Lando with Tome


To start with a lando instance and use tome to transition it to a static html site.
To accomplish it we will create a separate lando instance so as not to interfere with the live site/development.
Afterwards will create a gitlab repository and host the site on gitlab since it will be pure html at this point.

Recipe Type


Drupal Version

Recipe Tags


Related Documentation


Preliminary research from a project example.

Steps to Build

Build New Local:

- clone the site
- edit .lando.yml and edit name to make it unique
     (cannot use the pantheon name because it is already in use by your original site)
     (this site will not be used to maintain the pantheon site)
- run 'lando start'
- run 'lando pull' to pull down the database and files from live
- test to make sure you can access your lando site
- Install the Tome module
     'composer require drupal/tome'
- Enable the Tome module
     Use the UI or with drush 'drush en tome_static -y'
- create directories for Tome to generate content in the web root directory.
     (I suggest putting them in their own directory) ex.
- edit settings.php and add these settings
     $settings['tome_files_directory'] = 'tome/files';
     $settings['tome_content_directory'] = 'tome/content';
     $settings['tome_static_directory'] = 'tome/html';
- Setup is complete.  

Generate the static site:

     using drush:
        drush tome:static --uri=
           (Where "" is the domain of your production site)
     using the user interface:     
        login as a user with the "use tome static" permission
        submit the form at "/admin/config/tome/static/generate"

Prepare Local Gitlab Repository:

- create a bash script file to copy the files from the 'html' folder to the 'repo' folder.
     \cp -Rf html/* repo/
- run the bash script 
     or run the command '\cp -Rf html/* repo/' if you don't want to use the script

On Gitlab:

- Go to Projects page and create new project
- Set the visibility level to public   
- Create project 
- on the repository page follow the instructions to 'Push an existing folder'
      (on page<gitlab-acct>/<project-name&gt;)
      run the git commands from the 'tome/repo' folder
- setup domain
     go to settings > pages
     select 'New Domain'
     enter domain
        leave certificate enabled
     select 'Create New Domain'
     follow instructions to verify your ownership of the domain
        after the domain is verified, save your changes
- setup gitlab to serve the pages for the website
     go to project page and select 'Set up CI/CD'
     go to 'Apply a template' and choose 'HTML'
     save and commit the '.gitlab-ci.yml' file

Site will be live on gitlab after the pipeline completes.

Updating the site:

Had an issue with Tome when I edited and regenerated the site.  After regenerating the site the .git folder  and .gitlab-ci.yml file were overwritten.  

To get around this I had to: 
1) clone the gitlab repository into a different folder (this example I used 'gitlab')

2) created a shell program to copy html folder into the repository folder and placed it in the root of the 'tome' folder

Now all I had to do was run the shell script to copy the regenerated code into the repository folder so I could use git to push the changes back up to gitlab.

The bash script file consists of:
    \cp -Rf html/* gitlab/

Optional Steps

- If you wish to use the command line Tome requires Drush 9 or above (optional)
     (NOTE!!! if you install this and will be pushing this code back up to pantheon make sure you .gitignore vendor/drush & vendor/bin/drush directories as Pantheon does not play nice with multiple versions of drush)
     'composer require drush/drush:^9'

Supporting Organizations