Nextjs Blog Template | Ladder Theme | Blog
This repository is a Next.js implementation of the hugo-ladder-theme.
This is a Next.js blog template, and here's an introduction to the basic usage of this template.
npm install
npm run dev
Clone or fork locally, modify the configuration as described below, then select this repository for deployment on Vercel.
All deployment configurations can use the default settings, no special configuration is needed.
If you need to use edge or fluid compute, please modify the code or vercel configuration yourself.
Blog files in this repository need to be placed in the src/content/blog
directory, they can be markdown files or mdx files.
The following metadata needs to be configured according to your needs:
title
: Blog titledate
: Blog publication dateupdated
: Blog update datekeywords
: Blog keywords for SEO optimizationfeatured
: Whether to display on the homepagesummary
: Blog summary
All blog configurations are centralized in the src/lib/config.ts
file, which has the following advantages:
- Centralized management: All configurations are in one file, making it easy to maintain and modify
- Type safety: Using TypeScript provides type checking and auto-completion
- Reusability: Avoids duplicate configurations scattered across different files
- Consistency: Ensures the same configuration values are used everywhere
site: {
title: "Your blog title",
name: "Your blog name",
description: "Blog description",
keywords: ["keyword1", "keyword2"],
url: "https://yourdomain.com",
baseUrl: "https://yourdomain.com",
image: "https://yourdomain.com/og-image.png",
favicon: {
ico: "/favicon.ico",
png: "/favicon.png",
svg: "/favicon.svg",
appleTouchIcon: "/favicon.png",
},
manifest: "/site.webmanifest",
}
These configurations are used for:
- Basic website information display
- SEO optimization
- Browser tab icons
- Social media share previews
author: {
name: "Your name",
email: "Your email",
bio: "Personal bio",
}
Author information is used for:
- Homepage display
- RSS feed information
- Author information in blog posts
social: {
github: "https://github.com/yourusername",
x: "https://x.com/yourusername",
xiaohongshu: "https://www.xiaohongshu.com/user/profile/yourID",
wechat: "Your WeChat QR code image link",
buyMeACoffee: "https://www.buymeacoffee.com/yourusername",
}
These links will be displayed in:
- Social media links area on the homepage
- Social media icons in the navigation bar
giscus: {
repo: "Your GitHub repository name",
repoId: "Repository ID",
categoryId: "Category ID",
}
Using Giscus as the comment system requires:
- Install the Giscus app on GitHub
- Enable Discussions in your repository
- Get the configuration information and fill it in here
navigation: {
main: [
{
title: "Articles",
href: "/blog",
},
// You can add more navigation items
],
}
This configures the website's navigation menu, supporting:
- Regular links
- Dropdown menus with submenus
seo: {
metadataBase: new URL("https://yourdomain.com"),
alternates: {
canonical: './',
},
openGraph: {
type: "website" as const,
locale: "en_US",
},
twitter: {
card: "summary_large_image" as const,
creator: "@yourtwitterusername",
},
}
These configurations are used for:
- Search engine optimization
- Social media sharing cards
- Website metadata
rss: {
title: "Your blog title",
description: "Blog description",
feedLinks: {
rss2: "/rss.xml",
json: "/feed.json",
atom: "/atom.xml",
},
}
These configurations are used to generate:
- RSS 2.0 feeds
- JSON Feed
- Atom feeds
- Open the
src/lib/config.ts
file - Modify the corresponding configuration items according to your needs
- After saving the file, Next.js will automatically rebuild and apply the new configuration
Notes:
- Ensure all URLs are valid
- Image links should be accessible
- Social media links should be complete URLs
- After modifying configuration, it's recommended to check the website's:
- Homepage display
- Navigation menu
- SEO information
- Social media sharing effects
- RSS feeds
Modify the configuration in the scripts/generate-rss.js file, then run:
npm run generate-rss
Modify the configuration in the scripts/generate-sitemap.js file, then run:
npm run generate-sitemap
This repository is open source, welcome to star and fork. If you find this repository helpful, you can support me in the following ways: