Skip to content

Static site deployment workflow

A static site deployment workflow typically involves using a Static Site Generator (SSG) to build content into static files and then deploying those files to a web server or hosting service.^[600-developer__blog__hexo-blog__create-blog-Hexo.md] This process is often automated to streamline the publication of blog posts and updates.

Tooling and Generation

The foundation of this workflow is the SSG itself. For example, Hexo is a popular framework that can be installed globally via npm to manage the site structure.^[600-developer__blog__hexo-blog__create-blog-Hexo.md] The core generation commands generally follow a cycle of generating the site files and optionally testing them locally.

The standard workflow usually consists of the following steps^[600-developer__blog__hexo-blog__create-blog-Hexo.md]:

  1. Generation: Running hexo generate (or hexo g) to process source files (e.g., Markdown) and output static assets (HTML, CSS) into a public/ directory.^[600-developer__blog__hexo-blog__create-blog-Hexo.md]
  2. Local Testing: Running hexo server (or hexo s) to preview the site locally on localhost before publishing.^[600-developer__blog__hexo-blog__create-blog-Hexo.md]
  3. Deployment: Running hexo deploy (or hexo d) to transfer the generated files to the target hosting environment.^[600-developer__blog__hexo-blog__create-blog-Hexo.md]

To speed up development, plugins such as hexo-browsersync can be integrated to enable automatic page refreshing during local editing.^[600-developer__blog__hexo-blog__create-blog-Hexo.md]

Configuration and Automation

Deployment settings are typically managed within a configuration file (e.g., _config.yml) in the project root.^[600-developer__blog__hexo-blog__create-blog-Hexo.md] This file defines critical parameters such as the destination URL and the deployment method.

For hosting on [[Git]]-based platforms like GitHub Pages, a specific deployment plugin like hexo-deployer-git is required^[600-developer__blog__hexo-blog__create-blog-Hexo.md]. Once configured, the deployment process can be combined into a single command to automate the build and release pipeline^[600-developer__blog__hexo-blog__create-blog-Hexo.md].

Directory Structure

A typical project utilizing this workflow organizes files to separate source content from the final build artifacts^[600-developer__blog__hexo-blog__create-blog-Hexo.md]:

  • source/_posts/: Contains the raw content files (e.g., .md files).
  • public/: The output directory where the generated static site is stored after running the generation command.
  • _config.yml: The main configuration file for site settings.
  • themes/: Contains the site themes, which may have their own separate configuration files.

Sources

  • 600-developer__blog__hexo-blog__create-blog-Hexo.md