Skip to content

I want to remove the sequence number from the filename during route rewriting. #3595

@guanghuijs

Description

@guanghuijs

example:

rewrites:{
  // 'blogs/:module/:article':':module/:article'
  'foo/1.boo': 'foo/boo',
  'foo/2.coo': 'foo/coo',
},

Activity

admin8756

admin8756 commented on Feb 23, 2024

@admin8756

你这个表达有问题啊。你的页面之前是foo/1.boo访问的吗?不应该是以xxx.md结尾吗。
比如你这个应该是写成 {
'foo/1/boo.md': 'foo/boo.md',
'foo/1/coo.md': 'foo/coo.md',
}
当然肯定还有大佬可以通过正则来实现。

added
questionThis is a question rather than an issue or pull request
on Feb 23, 2024
guanghuijs

guanghuijs commented on Feb 23, 2024

@guanghuijs
Author

是这样的,最近发现一个自动生成侧边栏的插件,但是生成的侧边栏顺序是根据md文件名顺序生成的,为了让我的文章具有顺序性,我md命名的时候再文件前面加了序号,我想通过路由重写来把前面的序号去除了。

admin8756

admin8756 commented on Feb 23, 2024

@admin8756

那你这个问题应该不能用这个方法。因为这个重命名后。在编译的时候文件名又改回去了。没有意义的。

guanghuijs

guanghuijs commented on Feb 24, 2024

@guanghuijs
Author

意思是这个路由重写只对目录有效对文件名没效吗

admin8756

admin8756 commented on Feb 24, 2024

@admin8756

意思是这个路由重写只对目录有效对文件名没效吗

错。对文件名有效的。但是编译后的文件名。这样你的侧边栏就失效了啊。如果你的侧边栏也是依靠md文件名作为参考。我觉得你可以二次开发一下。这个侧边栏的插件。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThis is a question rather than an issue or pull requeststale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @admin8756@brc-dd@guanghuijs

        Issue actions

          I want to remove the sequence number from the filename during route rewriting. · Issue #3595 · vuejs/vitepress