Sure! Here’s a step-by-step guide on how to leverage GitHub Pages for each of the static site generators mentioned earlier: Jekyll, Hugo, MkDocs, Docusaurus, and VuePress.
- Install Jekyll and Bundler (if not already installed):
gem install jekyll bundler
- Navigate to the directory where you want your site, then run:
jekyll new your-site cd your-site
- Place your markdown files in the
_posts
directory or any other directory as needed.
- To preview your site locally:
bundle exec jekyll serve
- Create a new repository on GitHub (e.g.,
yourusername.github.io
for a personal site).
- Initialize a git repository, add your files, and push:
git init git add . git commit -m "Initial commit" git remote add origin https://github.com/yourusername/yourusername.github.io.git git push -u origin main
- Go to your repository settings, scroll down to the GitHub Pages section, and select the branch you want to use (usually
main
orgh-pages
).
- Install Hugo using Homebrew (macOS) or Chocolatey (Windows):
or
brew install hugo
choco install hugo
- Create a new Hugo site:
hugo new site your-site cd your-site
- Move your markdown files into the
content
folder.
- Add a theme (e.g., clone a theme into the
themes
directory) and update yourconfig.toml
:Updategit submodule add https://github.com/themename/hugo-theme.git themes/hugo-theme
config.toml
:theme = "hugo-theme"
- Build and serve the site locally:
hugo server
- Create a new repository on GitHub.
- Push your files:
git init git add . git commit -m "Initial commit" git remote add origin https://github.com/yourusername/yourusername.github.io.git git push -u origin main
- As in Jekyll, go to the GitHub Pages section in your repository settings to enable it.
- Install MkDocs via pip:
pip install mkdocs
- Create a new site:
mkdocs new your-site cd your-site
- Move your markdown files into the
docs
folder.
- Preview your site:
mkdocs serve
- Create a new repository on GitHub.
- Build the site and deploy:
mkdocs gh-deploy
- Create a new Docusaurus site:
npx create-docusaurus@latest your-site classic cd your-site
- Add your markdown files to the
docs
folder.
- Start the local development server:
npm start
- Create a new repository on GitHub.
- Build the site for deployment:
npm run build
- Deploy to GitHub Pages:
GITHUB_TOKEN=your_github_token npm run deploy
- Create a new VuePress site:
mkdir your-site cd your-site npm init -y npm install -D vuepress
- Create a
docs
folder and place your markdown files there.
- To run the development server:
npx vuepress dev docs
- Create a new repository on GitHub.
- Build the static files:
npx vuepress build docs
- Push the generated files (in
docs/.vuepress/dist
) to thegh-pages
branch:git init git add docs/.vuepress/dist git commit -m "Deploy VuePress" git remote add origin https://github.com/yourusername/yourusername.github.io.git git push -u origin gh-pages
- After pushing your files, visit
https://yourusername.github.io
in your browser to see your live site. - For any future updates, simply commit and push your changes to the corresponding branch.
If you have any specific questions about a particular step or need further clarification on any part, feel free to ask!