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 upgrade brew)
  • 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 myresearchblog

This 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/PaperMod

Update 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 MathJax

Add MathJax for Equations

To use MathJax for rendering mathematical equations:

  1. Create a file layouts/partials/mathjax.html with:
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
  1. 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 server

This 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.md

This 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 $$

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

  1. Create a new repository on GitHub
  2. Push your local repository:
git remote add origin https://github.com/yourusername/yourrepoName
git push -u origin main

Invite Collaborators

  1. Go to your GitHub repository settings
  2. Navigate to “Manage access”
  3. Click “Invite a collaborator” and enter their GitHub username
  4. Set appropriate permissions (typically write access)

Collaboration Workflow

Collaborators can:

  1. Clone the repository:

    git clone https://github.com/yourusername/yourrepoName
  2. Create a branch for their changes:

    git checkout -b new-feature
  3. Make changes, then commit them:

    git add .
    git commit -m "Description of changes"
  4. Push changes to GitHub:

    git push origin new-feature
  5. 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:

  1. Go to “Pages”
  2. Under “Source”, select “Deploy from a branch”
  3. 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: ./public

Set Up a Personal Access Token

  1. Go to your GitHub profile settings > Developer settings > Personal access tokens
  2. Generate a new token with the “repo” scope
  3. Add this token as a secret named PERSONAL_TOKEN in 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 = false in config.toml to 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

FeatureGitHub CollaborationGitHub Pages Hosting
Version ControlGit, branches, pull requestsAutomatic via Actions
Access ControlCollaborator permissionsPublic access, free tier
Deployment MethodManual push to mainAutomatic on push to main
URL FormatN/Ausername.github.io/reponame
Math SupportTheme-dependent, MathJaxServed 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.

Resources