Beginner's Guide to Setting Up a MkDocs Site with Publisher Plugin¶
Introduction¶
This guide will walk you through setting up a documentation website using MkDocs with the Publisher plugin. It's designed for beginners with little technical knowledge.
Prerequisites¶
- A computer running Ubuntu or a similar Linux distribution
- Basic familiarity with using the terminal
Step 1: Setting Up Your Environment¶
-
Open your terminal.
-
Create a new folder for your project:
-
Set up a virtual environment:
You should see (venv) at the beginning of your terminal prompt now.
Step 2: Installing Required Software¶
-
Install MkDocs and the Publisher plugin:
-
Install Node.js packages (for optimization tools):
-
Install Rust and Oxipng:
Follow the prompts during Rust installation.
Step 3: Configuring Your Site¶
-
Create a basic configuration file:
-
Paste the following into the file:
site_name: Your Site Name
theme:
name: material
plugins:
- search
- pub-meta
- pub-blog
- pub-obsidian
- pub-social
- pub-minifier
- pub-debugger
nav:
- Home: index.md
markdown_extensions:
- pymdownx.highlight
- pymdownx.superfences
copyright: "© 2024 Your Name"
Replace "Your Site Name" and "Your Name" with your preferences.
- Save and exit (press Ctrl+X, then Y, then Enter).
Step 4: Creating Content¶
-
Create a docs folder and an index file:
-
(Optional) Add a blog post:
Step 5: Building and Serving Your Site¶
-
Build your site:
-
Serve your site locally:
-
Open a web browser and go to
http://localhost:5001to see your site.
Step 6: Simplifying Future Use¶
Create an alias for easy startup:
-
Open your aliases file:
-
Add this line:
-
Save and exit (Ctrl+X, then Y, then Enter).
-
Apply the changes:
Now, you can start your site anytime by just typing serve-test-site in the terminal.
Conclusion¶
You now have a basic MkDocs site with the Publisher plugin set up. To add more pages, create additional .md files in the docs folder and update the nav section in mkdocs.yml.
Remember to activate your virtual environment (step 1.3) each time you start a new terminal session to work on your site.
Happy documenting!