Introduction
This guide provides a comprehensive walkthrough for creating a research blog using Hugo, Markdown, and MathJax. It covers how to set up your site, collaborate with group members using Git and GitHub, and host your site on GitHub Pages for free.
Key Points
- Hugo is a fast static site generator ideal for research blogs with Markdown support
- MathJax enables LaTeX-style equations rendering in your posts
- Git and GitHub facilitate collaboration among group members
- GitHub Pages provides free hosting at a URL like username.github.io/reponame
- GitHub Actions automates deployment for efficient updates
Part 1: Setting Up Hugo and Your Site
Install Hugo
Depending on your operating system:
- Mac: Use
brew install hugo(before installing, first update and upgradebrew) - Windows: Download from Hugo’s download page and follow installation instructions
- Linux: Download the binary from Hugo’s download page and make it executable
Create Your Site
Create a new Hugo site by running:
hugo new site myresearchblogThis generates a directory with the basic structure for your site.
Choose and Install a Theme
Select a theme that suits your needs. For this guide, we’ll use PaperMod:
git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperModUpdate your config.toml file to set the theme and basic information:
theme = "PaperMod"
title = "My Research Blog"
author = "Your Name"
[params]
katex = false # Disable KaTeX to avoid conflicts with MathJaxAdd MathJax for Equations
To use MathJax for rendering mathematical equations:
- Create a file
layouts/partials/mathjax.htmlwith:
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>- Add the following to
layouts/partials/head.html:
{{ if .Params.math }}
{{ partial "mathjax.html" . }}
{{ end }}This loads MathJax only on pages that need it, improving performance.
Test Your Site Locally
Run your site locally with:
hugo serverThis serves your site at http://localhost:1313, where you can preview it as you make changes.
Part 2: Writing Content with Markdown and MathJax
Creating Posts
Create a new post with:
hugo new posts/your-post-name.mdThis generates a Markdown file with front matter. For posts containing math equations, add math: true to the front matter:
---
title: "Sample Post"
date: "2025-03-24"
math: true
---
This is a sample post with math.
The equation is $E = mc^2$.
And a displayed equation:
\[ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} \]Using Markdown and Math
- Use standard Markdown syntax for formatting text, lists, links, etc.
- For math equations, use LaTeX syntax:
- Inline equations:
$equation$(e.g.,$E = mc^2$) - Display equations:
\[ equation \]or$$ equation $$
- Inline equations:
Part 3: Collaborating with Group Members
Initialize a Git Repository
Set up Git for version control:
git init
git add .
git commit -m "Initial commit"Create a GitHub Repository
- Create a new repository on GitHub
- Push your local repository:
git remote add origin https://github.com/yourusername/yourrepoName
git push -u origin mainInvite Collaborators
- Go to your GitHub repository settings
- Navigate to “Manage access”
- Click “Invite a collaborator” and enter their GitHub username
- Set appropriate permissions (typically write access)
Collaboration Workflow
Collaborators can:
-
Clone the repository:
git clone https://github.com/yourusername/yourrepoName -
Create a branch for their changes:
git checkout -b new-feature -
Make changes, then commit them:
git add . git commit -m "Description of changes" -
Push changes to GitHub:
git push origin new-feature -
Create a pull request for review and merging
This workflow ensures changes are tracked and reviewed before publication.
Part 4: Hosting on GitHub Pages
Set Up GitHub Pages
In your GitHub repository settings:
- Go to “Pages”
- Under “Source”, select “Deploy from a branch”
- Choose “gh-pages” as the branch
Automate Deployment with GitHub Actions
Create a file .github/workflows/hugo.yml with:
name: Deploy Hugo site to Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: Ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup Hugo
uses: peaceiris/actions-hugo@master
with:
hugo-version: 'latest'
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
external_repo: yourusername/yourrepoName
publish_branch: gh-pages
publish_dir: ./publicSet Up a Personal Access Token
- Go to your GitHub profile settings > Developer settings > Personal access tokens
- Generate a new token with the “repo” scope
- Add this token as a secret named
PERSONAL_TOKENin your repository settings
Access Your Site
After pushing changes to the main branch, the site will build and deploy automatically. Access it at:
https://yourusername.github.io/yourrepoName
Important Considerations
- Some themes (like PaperMod) include KaTeX by default, requiring
katex = falseinconfig.tomlto use MathJax instead - GitHub Actions automates the build process, ensuring updates happen seamlessly when collaborators push changes
- Using branches for development helps prevent conflicts when multiple people work on the site
- Clear communication among team members is essential for effective collaboration
Comparison of Collaboration and Hosting Options
| Feature | GitHub Collaboration | GitHub Pages Hosting |
|---|---|---|
| Version Control | Git, branches, pull requests | Automatic via Actions |
| Access Control | Collaborator permissions | Public access, free tier |
| Deployment Method | Manual push to main | Automatic on push to main |
| URL Format | N/A | username.github.io/reponame |
| Math Support | Theme-dependent, MathJax | Served as static files |
Conclusion
By following this guide, you can create a professional research blog that supports mathematical notation, enables collaboration among team members, and is hosted for free on GitHub Pages with automatic updates. The combination of Hugo, Markdown, MathJax, Git, and GitHub provides a powerful yet flexible system for academic and research publishing.