vuejs / vitepress

Vite & Vue powered static site generator.

Home Page:https://vitepress.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

能否像hexo一样,新文章自动发布到首页且不需要配置路由

cpupg opened this issue · comments

Is your feature request related to a problem? Please describe.

近期想用github pages搭建个人博客,先选的hexo,后选的vitepress。默认情况下,hexo会将新文章自动发表到首页,不需要配置路由,vitepress需要配置路由并展示在侧边栏。

Recently I want to use github pages to build a personal blog, first selected hexo, then selected vitepress. By default, hexo automatically publishes new articles to the front page without the need to configure a route, while vitepress needs to configure a route and display it in the sidebar.

Describe the solution you'd like

弱化路由功能,或者增加插件来绕开路由,直接将文章发布到主页并分页。使用侧边栏的模式适合做文档,不适合做博客。

Weaken the routing function, or add plugins to bypass the routing and publish articles directly to the home page and page. The sidebar model is good for documentation, not for blogging.

Describe alternatives you've considered

我搜索了issue,发现 #1297 ,但是还是围绕侧边栏展开,不能自动发表。

I searched the issue and found #1297, but it was still around the sidebar and not automatically published.

Additional context

No response

Validations

maybe tracked in #1838

maybe tracked in #1838

thank u, i will research this later.

VitePress uses file-based routing, which means the generated HTML pages are mapped from the directory structure of the source Markdown files. So if we have a posts folder with .md files and build site with createContentLoader like posts.data.ts, the posts data can be rendered to home page with custom components for pagination, e.g. my VitePress theme for blog.

VitePress uses file-based routing, which means the generated HTML pages are mapped from the directory structure of the source Markdown files. So if we have a posts folder with .md files and build site with createContentLoader like posts.data.ts, the posts data can be rendered to home page with custom components for pagination, e.g. my VitePress theme for blog.

thank u,this is a good method that in offical docs and i will try this later.