Blog Functionality
Docusaurus includes a built-in blog plugin that provides a full-featured blogging platform with support for authors, tags, RSS feeds, and rich content formatting.
Overview
The blog is configured in docusaurus.config.ts and uses the @docusaurus/preset-classic blog preset. Blog posts are stored in the docusaurus/blog/ directory as MDX files.
Features
- MDX support: Write blog posts with JSX components embedded in Markdown
- Author management: Define authors in
blog/authors.ymlwith names, titles, URLs, and profile images - Tag system: Organize posts with tags defined in
blog/tags.ymlwith labels, permalinks, and descriptions - RSS/Atom feeds: Automatic feed generation for blog subscribers
- Reading time: Automatic calculation and display of estimated reading time
- Truncation: Use
<!-- truncate -->to control post preview length - SEO optimization: Built-in meta tags, OpenGraph, and Twitter card support
- Responsive images: Automatic image optimization and responsive sizing
Configuration
The blog is configured in docusaurus.config.ts with enhanced settings for better SEO and user experience. See Blog Plugin Configuration for complete documentation of all available options.
Key settings:
- SEO: Custom title, description, and copyright for feeds
- Sidebar: Show 10 recent posts
- Reading time: Enabled for all posts
- Feeds: RSS and Atom feeds with XSLT styling
- Best practices: Warnings for inline tags/authors and missing truncate markers
Key options:
showReadingTime: Display estimated reading time on postsfeedOptions: Enable RSS and Atom feed generationeditUrl: GitHub edit links for blog postsonInlineTags/onInlineAuthors: Warn when authors/tags are defined inline instead of in YAML filesonUntruncatedBlogPosts: Warn when posts don't include<!-- truncate -->
File Structure
docusaurus/blog/
├── authors.yml # Author definitions
├── tags.yml # Tag definitions
├── YYYY-MM-DD-post-slug.mdx # Blog posts (MDX format)
└── assets/ # Blog images and assets (optional)
Creating a Blog Post
Basic Post Structure
Create a new file in docusaurus/blog/ with the naming pattern YYYY-MM-DD-slug.mdx:
---
slug: "why-move-your-website-from-wordpress-to-webflow"
title: "Why Move Your Website From Wordpress To Webflow?"
date: "2025-09-29"
tags:
- website-ux
description: "Migrations might be a pain, but longer term they're worth it."
image: "/img/blog/featured-image.avif"
authors:
- pacing-agency
---
Your introductory paragraph here...
<!-- truncate -->
Main content starts here after the fold...
Frontmatter Fields
| Field | Required | Description |
|---|---|---|
slug | No | URL slug (defaults to filename without date) |
title | Yes | Post title |
date | Yes | Publication date (YYYY-MM-DD format) |
tags | No | Array of tag IDs from tags.yml |
description | No | Post summary for SEO and previews |
image | No | Featured image URL (absolute or relative) |
authors | No | Array of author IDs from authors.yml |
Truncation Marker
Use <!-- truncate --> to control where the post preview ends on the blog index:
This text appears in the preview...
<!-- truncate -->
This text only appears on the full post page.
Authors Configuration
Define authors in blog/authors.yml:
ben-power:
name: Ben Power
title: Founder, Pacing Agency
url: https://pacing.agency
image_url: https://pacing.agency/img/ben-power.jpg
pacing-agency:
name: Pacing Agency
title: Digital Marketing Agency
url: https://pacing.agency
image_url: https://pacing.agency/img/logo.svg
Then reference authors in post frontmatter:
authors:
- ben-power
- cam-bowen
Tags Configuration
Define tags in blog/tags.yml:
website-ux:
label: Website & UX
permalink: /website-ux
description: Website design, development, and user experience topics
data-analytics:
label: Data & Analytics
permalink: /data-analytics
description: Technical insights on tracking, analytics, and data accuracy
Then reference tags in post frontmatter:
tags:
- website-ux
- data-analytics
Using MDX Components
Import and use React components in blog posts:
---
title: My Post
---
import FAQStructuredData from '@site/src/theme/MDXComponents/FAQStructuredData';
## My heading
Regular markdown content...
<FAQStructuredData
faqs={[
{ question: "What is this?", answer: "An answer" }
]}
collapsible={true}
/>
Blog URLs
- Blog index:
/blog - Post page:
/blog/slug-from-frontmatter - Tag pages:
/blog/tags/tag-permalink - Author pages:
/blog/authors/author-id(if multiple posts) - RSS feed:
/blog/rss.xml - Atom feed:
/blog/atom.xml
SEO Best Practices
- Always include
description: Used for meta descriptions and OpenGraph - Add featured images: Use
imagefield for social sharing cards - Use meaningful slugs: Keep slugs short, descriptive, and keyword-rich
- Include alt text: Add alt text to all images in post content
- Structure with headings: Use H2-H4 for proper document outline
- Add internal links: Link to related docs and other blog posts
Webflow Blog Sync
For syncing blog posts from Webflow CMS to Docusaurus, see the sync script documentation:
# Run the Webflow blog sync script
python3 scripts/resources/webflow/scripts/sync_blog.py
See scripts/resources/webflow/README.md for complete sync script documentation.
Navigation Integration
The blog is integrated into navigation via:
- Navbar: Add blog link in
docusaurus.config.tsnavbar items - Homepage: Link to
/blogfrom homepage sections - Sidebar: Blog is NOT in the docs sidebar (standalone section)
Example navbar configuration:
navbar: {
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
},
{
to: '/blog',
label: 'Blog',
position: 'left'
},
// ...
],
}
Local Development
Start the dev server to preview blog posts:
cd docusaurus
npm start
Navigate to http://localhost:3000/blog to view the blog.
Build and Deploy
Blog posts are automatically built and deployed with the main site:
cd docusaurus
npm run build
The blog is generated to build/blog/ with all posts, tag pages, and feeds.
Best Practices
- Use descriptive filenames:
2025-01-15-server-side-tracking-guide.mdxis better than2025-01-15-post.mdx - Always include truncation marker: Keeps blog index clean and fast
- Optimize images: Use WebP or AVIF formats, compress before upload
- Leverage tags: Helps readers discover related content
- Update authors.yml: Add new team members as they start blogging
- Cross-link content: Link to relevant docs, tools, and other posts
- Test locally: Always preview posts before committing
- Use MDX sparingly: Only embed components when they add real value
Troubleshooting
Post not showing up
- Check filename format:
YYYY-MM-DD-slug.mdx - Verify frontmatter YAML is valid
- Ensure date is not in the future
- Check for build errors:
npm run build
Author/tag not rendering
- Verify ID matches entry in
authors.ymlortags.yml - Check YAML indentation (use spaces, not tabs)
- Ensure YAML is valid (use a validator if needed)
Images not loading
- Use absolute paths
/img/blog/image.jpgor relative paths - Place images in
docusaurus/static/img/blog/ - Check image file exists and path is correct
- Verify image format is supported (jpg, png, webp, avif, svg)
MDX syntax errors
- Escape special characters in content:
\{,\<,\> - Use code blocks for code examples (prevents JSX parsing)
- Test with
npm startornpm run build
Related Documentation
- FAQ Structured Data - Embed FAQs in blog posts
- Copy/Download Buttons - Add copy buttons to code blocks
- Tool Categorization System - Organize and categorize content
- Webflow Sync Scripts - Webflow API and sync automation