Add RSS feed, sitemap, robots.txt, and code syntax highlighting
Implements essential blog features: 1. RSS Feed (/feed.xml) - Latest 20 posts with full content - Proper XML escaping and CDATA sections - Includes tags, authors, and descriptions - Auto-discovery link in HTML head 2. Sitemap (/sitemap.xml) - All posts, pages, and tag pages - Proper lastModified dates and priorities - Automatic generation via Next.js built-in support 3. Robots.txt (/robots.txt) - Allow all crawlers - Disallow API and admin routes - Links to sitemap for better SEO 4. Code Syntax Highlighting - Using rehype-pretty-code + Shiki - GitHub Dark/Light themes based on user preference - Line numbers for all code blocks - Support for highlighted lines - Inline code styling - Code title support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { visit } from 'unist-util-visit';
|
||||
import rehypeSlug from 'rehype-slug';
|
||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import rehypePrettyCode from 'rehype-pretty-code';
|
||||
|
||||
export const Post = defineDocumentType(() => ({
|
||||
name: 'Post',
|
||||
@@ -86,6 +87,16 @@ export default makeSource({
|
||||
markdown: {
|
||||
remarkPlugins: [remarkGfm],
|
||||
rehypePlugins: [
|
||||
[
|
||||
rehypePrettyCode,
|
||||
{
|
||||
theme: {
|
||||
dark: 'github-dark',
|
||||
light: 'github-light',
|
||||
},
|
||||
keepBackground: false,
|
||||
},
|
||||
],
|
||||
rehypeSlug,
|
||||
[rehypeAutolinkHeadings, { behavior: 'wrap' }],
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user