Skip to content


We've envisioned the plugin with zero configuration as it's quicker to develop and easier to use. If you'd like to change the default behaviour, please open an issue.

pip install mkdocs-newsletter

To enable this plugin, you need to declare it in your config file mkdocs.yml.

  - git-revision-date-localized:
      type: timeago
  - autolinks
  - section-index
  - mkdocs-newsletter

We rely on:

To create the RSS feeds well we also need the next configuration:

  - toc:
      baselevel: 2

Finally make sure that you have a nav section in your mkdocs.yml file with at least one entry, otherwise the plugin won't work.

MkDocs configuration enhancements

There are some MkDocs tweaks that can make the plugin work better:

It can be useful to let know the readers that you publish the changes through newsletters and RSS feeds, we can do that in the footer and the header.

This section is assuming you're using the Material theme. It may work on others but I haven't tested it

You can add the RSS icon to the Social links footer section that points to the newsletter landing page with the next snippet:

    - icon: fontawesome/solid/rss

You can select from fontawesome/solid/rss-square or fontawesome/solid/rss.

You can add an announce banner at the top telling your readers to subscribe to the RSS feed by extending the theme and overriding the announce block with something like:

Assuming that the override theme directory is theme:

File: mkdocs.yml

  name: material
  custom_dir: theme

File: theme/main.html

{% extends "base.html" %}

{% block announce %}
<a href="">
    For updates subscribe to the  <strong>RSS feed</strong>
    <span class="rss icon">
    {% include ".icons/fontawesome/solid/rss.svg" %}
{% endblock %}

Update the site automatically

It's useful to create a continuous integration pipeline to keep the site updated and automatically build the newsletters.

If you're using github, you can use the next configuration:

File: .github/workflows/update.yml
name: github pages

    - master
    - cron: 11 08 * * *

    runs-on: ubuntu-latest
    - uses: actions/checkout@v2
        persist-credentials: false
        # Number of commits to fetch. 0 indicates all history.
        # Default: 1
        fetch-depth: 0

    - name: Setup Python
        # uses: actions/setup-python@v1
        # with:
        #   python-version: '3.8'
        uses: actions/setup-python@v2
        python-version: 3.8
        architecture: x64

    - name: Cache dependencies
        uses: actions/cache@v1
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
        restore-keys: |
            ${{ runner.os }}-pip-

    - name: Install dependencies
        run: pip install pip-tools

    - name: Update requirements
        run: make update

    - name: Make the site
        run: make build-docs

    - name: Commit files
        run: |
        git config --local ""
        git config --local "GitHub Action"
        git add requirements.txt
        git add docs/newsletter
        git diff-index --quiet HEAD \
            || git commit -m "chore: update dependency and publish newsletters"

    - name: Push changes
        uses: ad-m/github-push-action@master
        github_token: ${{ secrets.GITHUB_TOKEN }}
        branch: master

    - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
        publish_dir: ./site

It assumes that you have the next Makefile:

File: Makefile
.PHONY: update
    @echo "-------------------------"
    @echo "- Updating dependencies -"
    @echo "-------------------------"

    rm requirements.txt
    touch requirements.txt
    pip-compile -Ur --allow-unsafe

    pip install -r requirements.txt

    @echo ""

.PHONY: build-docs
    @echo "--------------------------"
    @echo "- Building documentation -"
    @echo "--------------------------"

    mkdocs build

    @echo ""

If you don't want to see the newsletters in the result of the search, use the mkdocs-exclude-search plugin to exclude all articles under newsletter/.

To do so:

  1. Install the plugin with
    pip install mkdocs-exclude-search
  2. Add the following configuration to your mkdocs.yml
      - search
      - exclude-search:
            - newsletter/*

Note that newsletter/* excludes all markdown files within a directory and its children. The paths must be relative to the docs/ directory.