Vercel
- Lorem ipsum dolor sit amet, consectetur adipiscing elit
- Vestibulum convallis sit amet nisi a tincidunt
- In hac habitasse platea dictumst
- In scelerisque nibh non dolor mollis congue sed et metus
- Praesent sed risus massa
- Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
Getting Started
1. Clone the Repository
https://github.com/kaitas/vercel-MkDocs-material/
1 2 | |
Replace <your_repository_url> with the URL of your Git repository and <your_repository_directory> with the name of the directory you want to clone the project into.
2. Install Dependencies
1 | |
This command installs the necessary Python packages specified in the requirements.txt file, including mkdocs, mkdocs-material, and mkdocs-blog-plugin.
3. Configure MkDocs
- Edit
mkdocs.ymlto customize your site. This includes:- Setting the
site_name,site_description, andsite_author. - Configuring the
theme,palette,font, andfeatures. - Adding a
navsection to structure your documentation (optional). If you omit thenavsection, MkDocs will automatically generate a navigation menu based on your file structure.
- Setting the
- Add your documentation content as Markdown files (
.md) in thedocsdirectory. - Add blog posts as Markdown files in the
docs/blog/postsdirectory. Each blog post should have a filename in the formatYYYY-MM-DD-post-title.mdand include YAML front matter for the title and date:
1 2 3 4 5 6 | |
4. Build and Serve Locally
1 | |
This will start a local development server. Open your web browser and go to http://127.0.0.1:8000/ to view your site.
Deployment to Vercel
This project is optimized for deployment on Vercel.
Using the Vercel Dashboard (Recommended)
-
Create a Vercel Account: If you don't already have one, sign up for a free account at vercel.com.
-
Import Your Git Repository: In your Vercel dashboard, click on "New Project" and import your Git repository (e.g., GitHub, GitLab, Bitbucket).
-
Configure the Project:
- Framework Preset: Select
Other. - Build Command: Enter
mkdocs build -d publicand turn the Override on. - Output Directory: Enter
publicand turn the Override on. - Install Command: Enter
pip install -r requirements.txtand turn the Override on. - Development Command: Enter
mkdocs serveand turn the Override on.
Important: You need to configure these settings even if you have a
vercel.jsonfile because thebuildssection invercel.jsonoverrides the Build & Development Settings in the Vercel dashboard.Settings Screenshot:
- Framework Preset: Select
-
Deploy: Click the "Deploy" button. Vercel will automatically build and deploy your site.
Using the Vercel CLI
-
Install the Vercel CLI:
1npm install -g vercel -
Deploy your project:
1vercelFollow the prompts to link your project to your Vercel account.
-
Deploy to production:
1vercel --prod
Troubleshooting
- 404 Errors: If you encounter 404 errors after deploying, double-check the following:
- Ensure that your
vercel.jsonfile is correctly configured with thebuildssection as described above. - Confirm that the
outputDirectoryin yourvercel.jsonfile is set topublic. - Verify that your
mkdocs.ymlfile specifiessite_dir: public. - Clear your Vercel project's cache by redeploying and unchecking "Use existing build cache."
- Ensure that your
- Other Build Errors: Most build errors are caused by typos in
mkdocs.ymlor missing packages inrequirements.txt. Carefully review your recent changes and the Vercel build logs for clues.
TIPS
vercel.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
package.json
1 2 3 4 5 6 7 8 9 | |