# next-blog **Repository Path**: miss-tree/next-blog ## Basic Information - **Project Name**: next-blog - **Description**: 使用next.js搭建的博客项目 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-02-25 - **Last Updated**: 2025-12-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![tailwind-nextjs-banner](/public/static/images/twitter-card.png) # [Tailwind Nextjs Starter Blog](https://github.com/timlrx/tailwind-nextjs-starter-blog) 博客模板基于`Tailwind Nextjs Starter Blog`上调整,代码块模板类似hugo主题 ## 功能 - Next.js with Typescript - [Contentlayer](https://www.contentlayer.dev/) to manage content logic - Easy styling customization with [Tailwind 3.0](https://tailwindcss.com/blog/tailwindcss-v3) and primary color attribute - [MDX - write JSX in markdown documents!](https://mdxjs.com/) - Near perfect lighthouse score - [Lighthouse report](https://www.webpagetest.org/result/230805_BiDcBQ_4H7) - Lightweight, 85kB first load JS - Mobile-friendly view - Light and dark theme - Font optimization with [next/font](https://nextjs.org/docs/app/api-reference/components/font) - Integration with [pliny](https://github.com/timlrx/pliny) that provides: - Multiple analytics options including [Umami](https://umami.is/), [Plausible](https://plausible.io/), [Simple Analytics](https://simpleanalytics.com/), Posthog and Google Analytics - Comments via [Giscus](https://github.com/laymonage/giscus), [Utterances](https://github.com/utterance/utterances) or Disqus - Newsletter API and component with support for Mailchimp, Buttondown, Convertkit, Klaviyo, Revue, Emailoctopus and Beehiiv - Command palette search with [Kbar](https://github.com/timc1/kbar) or Algolia - Server-side syntax highlighting with line numbers and line highlighting via [rehype-prism-plus](https://github.com/timlrx/rehype-prism-plus) - Math display supported via [KaTeX](https://katex.org/) - Citation and bibliography support via [rehype-citation](https://github.com/timlrx/rehype-citation) - [Github alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) via [remark-github-blockquote-alert](https://github.com/jaywcjlove/remark-github-blockquote-alert) - Automatic image optimization via [next/image](https://nextjs.org/docs/basic-features/image-optimization) - Support for tags - each unique tag will be its own page - Support for multiple authors - 3 different blog layouts - 2 different blog listing layouts - Support for nested routing of blog posts - Projects page - Preconfigured security headers - SEO friendly with RSS feed, sitemaps and more! ## Sample posts - [A markdown guide](https://tailwind-nextjs-starter-blog.vercel.app/blog/github-markdown-guide) - [Learn more about images in Next.js](https://tailwind-nextjs-starter-blog.vercel.app/blog/guide-to-using-images-in-nextjs) - [A tour of math typesetting](https://tailwind-nextjs-starter-blog.vercel.app/blog/deriving-ols-estimator) - [Simple MDX image grid](https://tailwind-nextjs-starter-blog.vercel.app/blog/pictures-of-canada) - [Example of long prose](https://tailwind-nextjs-starter-blog.vercel.app/blog/the-time-machine) - [Example of Nested Route Post](https://tailwind-nextjs-starter-blog.vercel.app/blog/nested-route/introducing-multi-part-posts-with-nested-routing) ## Quick Start Guide Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. Edit the layout in `app` or content in `data`. With live reloading, the pages auto-updates as you edit them. ## Extend / Customize `data/siteMetadata.js` - 包含了大部分网站相关的信息,这些信息应该根据用户的需要进行修改。 `data/authors/default.md` - 默认博客信息. 可以通过修改此文件 `data/authors`. `data/projectsData.js` - 项目的卡片数据. `data/headerNavLinks.js` - 导航栏跳转. `data/logo.svg` - 网站 logo. `data/blog` - replace with your own blog posts. `public/static` - 静态资源存储. `tailwind.config.js` and `css/tailwind.css` - 样式配置修改. `css/prism.css` - 控制代码块的样式,相关主题请查阅 e.g. [prism themes](https://github.com/PrismJS/prism-themes). `contentlayer.config.ts` - 内容层的配置,包括定义内容源和使用的MDX插件. [文档](https://www.contentlayer.dev/docs/getting-started). `components/MDXComponents.js` - 通过在这里指定你自己的JSX代码或React组件。然后你可以直接在'。Mdx ‘ or ’。md的文件。默认情况下,自定义链接、“next/image”组件、目录组件和时事通讯表单被传递下来。注意,组件应该默认导出 [Next.js 存在的问题](https://github.com/vercel/next.js/issues/51593). `layouts` - layout模板层: - There are currently 3 post layouts available: `PostLayout`, `PostSimple` and `PostBanner`. `PostLayout` is the default 2 column layout with meta and author information. `PostSimple` is a simplified version of `PostLayout`, while `PostBanner` features a banner image. - There are 2 blog listing layouts: `ListLayout`, the layout used in version 1 of the template with a search bar and `ListLayoutWithTags`, currently used in version 2, which omits the search bar but includes a sidebar with information on the tags. `app` - 路由页面 `next.config.js` - next.js 相关配置 ## Post Content is modelled using [Contentlayer](https://www.contentlayer.dev/), which allows you to define your own content schema and use it to generate typed content objects. See [Contentlayer documentation](https://www.contentlayer.dev/docs/getting-started) for more information. ### Frontmatter Frontmatter follows [Hugo's standards](https://gohugo.io/content-management/front-matter/). Please refer to `contentlayer.config.ts` for an up to date list of supported fields. The following fields are supported: ``` title (必填) date (必填) tags (optional) lastmod (optional) draft (optional) summary (optional) images (optional) authors (optional list which should correspond to the file names in `data/authors`. Uses `default` if none is specified) layout (optional list which should correspond to the file names in `data/layouts`) canonicalUrl (optional, canonical url for the post for SEO) ``` 模板样式: ``` --- title: 'Introducing Tailwind Nexjs Starter Blog' date: '2021-01-12' lastmod: '2021-01-18' tags: ['next-js', 'tailwind', 'guide'] draft: false summary: 'Looking for a performant, out of the box template, with all the best in web technology to support your blogging needs? Checkout the Tailwind Nextjs Starter Blog template.' images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg'] authors: ['default', 'sparrowhawk'] layout: PostLayout canonicalUrl: https://tailwind-nextjs-starter-blog.vercel.app/blog/introducing-tailwind-nextjs-starter-blog --- ``` Run: ```sh $ EXPORT=1 UNOPTIMIZED=1 yarn build ``` Then, deploy the generated `out` folder or run `npx serve out` it locally. > [!IMPORTANT] > If deploying with a URL base path, like https://example.org/myblog you need an extra `BASE_PATH` shell-var to the build command: > > ```sh > $ EXPORT=1 UNOPTIMIZED=1 BASE_PATH=/myblog yarn build > ``` > > => In your code, `${process.env.BASE_PATH || ''}/robots.txt` will print `"/myblog/robots.txt"` in the `out` build (or only `/robots.txt` if `yarn dev`, ie: on localhost:3000) > [!TIP] > Alternatively to `UNOPTIMIZED=1`, to continue using `next/image`, you can use an alternative image optimization provider such as Imgix, Cloudinary or Akamai. See [image optimization documentation](https://nextjs.org/docs/app/building-your-application/deploying/static-exports#image-optimization) for more details.