Skip to content

alvarcarto/alvarcarto-site-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static site generator for alvarcarto.com

This generator transforms our WordPress site to a static version.

Usage

  • Run the latest version of WordPress locally or in e.g. AWS. Let's assume you have it running at http://localhost:3000.

  • Run node . http://localhost:3000

    You can also test this generator by pointing it to node . https://alvarcarto.com. Beware that CloudFlare may have some scraping protections in place.

  • cd ../alvarcarto.com

  • Commit changes and push to Github

  • Verify that QA site looks OK (auto-deployment enabled)

  • Deploy to production and lock the deployment

Production generation

The currently working command is below. Link checker is broken: stevenvachon/broken-link-checker#76.

node . --no-check-broken-links -o ../alvarcarto.com https://alvarcarto-wordpress.herokuapp.com

Local generation

  1. Start alvarcarto-site with docker-compose up

  2. Run generator

    node . --no-check-broken-links -o ../alvarcarto.com http://localhost:8080
    

Install

  • npm install

  • cd .. && git clone git@github.com:kimmobrunfeldt/alvarcarto.com.git

    Clone alvarcarto.com repository aside this repository. You should have e.g. code/alvarcarto-site-generator and code/alvarcarto.com repo directories.

    The generator will spit the files to ../alvarcarto.com by default.

How it works

  1. Scrape the WordPress site withnode-website-scraper.

    The scraper should make almost 1-to-1 copy of the site. Directory structure and everything should match.

  2. Download manual urls

    Not all files are reachable via normal site links and scraping, so we have a whitelist of urls to manually download. For example sitemap files.

  3. Copy everything from files/* on top of that

This is useful for e.g. Netlify-specific files or any possible manual overrides.

Notes

Some broken links are normal. They are configured in top-level site hosting instead of WP level.

BROKEN https://alvarcarto-wordpress.herokuapp.com/phone-background/ -> generator/
BROKEN https://alvarcarto-wordpress.herokuapp.com/phone-background/ -> generator/

About

Site generator for alvarcarto.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published