Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks done
cpupg opened this issue Apr 20, 2024 · 4 comments
Closed
4 tasks done

Comments

@cpupg
Copy link

cpupg commented Apr 20, 2024

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

@awxiaoxian2020
Copy link
Collaborator

maybe tracked in #1838

@cpupg
Copy link
Author

cpupg commented Apr 21, 2024

maybe tracked in #1838

thank u, i will research this later.

@laplacetw
Copy link

laplacetw commented Apr 24, 2024

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.

@cpupg
Copy link
Author

cpupg commented Apr 24, 2024

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.

@cpupg cpupg closed this as completed Apr 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants