Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

frontmatters scoped path #39

Closed
FuckDoctors opened this issue Dec 5, 2019 · 1 comment
Closed

frontmatters scoped path #39

FuckDoctors opened this issue Dec 5, 2019 · 1 comment

Comments

@FuckDoctors
Copy link
Contributor

Feature request

What problem does this feature solve?

With these settings:

frontmatters: [
  {
    // Unique ID of current classification
    id: 'tag',
    // Decide that the frontmatter keys will be grouped under this classification
    keys: ['tag', 'tags'],
    // Path of the `entry page` (or `list page`)
    path: '/tag/',
    frontmatter: { title: 'Tag' },
    layout: 'BlogTagsLayout',
    // Layout of the `scope page`
    scopeLayout: 'BlogTagLayout'
  },
  {
    // Unique ID of current classification
    id: 'en_tag',
    // Decide that the frontmatter keys will be grouped under this classification
    keys: ['tag', 'tags'],
    // Path of the `entry page` (or `list page`)
    path: '/en/tag/',
    frontmatter: { title: 'Tag' },
    layout: 'BlogTagsLayout',
    // Layout of the `scope page`
    scopeLayout: 'BlogTagLayout'
  }
]

I got:

[@vuepress/plugin-blog] ====== Automatically Added Index Pages ======
permalink               meta                                   pid     id             frontmatter
/tag/                   {"pid":"tag","id":"tag"}                                      {"layout":"BlogTagsLayout","title":"Tag"}
/en/tag/                {"pid":"en_tag","id":"en_tag"}                                {"layout":"BlogTagsLayout","title":"Tag"}
/tag/vuepress/          {"pid":"tag","id":"vuepress"}          tag     vuepress       {"layout":"BlogTagLayout","title":"vuepress tag"}
/tag/vuepress-blog/     {"pid":"tag","id":"vuepress-blog"}     tag     vuepress-blog  {"layout":"BlogTagLayout","title":"vuepress-blog tag"}
/tag/js/                {"pid":"tag","id":"js"}                tag     js             {"layout":"BlogTagLayout","title":"js tag"}
/en_tag/vuepress/       {"pid":"en_tag","id":"vuepress"}       en_tag  vuepress       {"layout":"BlogTagLayout","title":"vuepress en_tag"}
/en_tag/vuepress-blog/  {"pid":"en_tag","id":"vuepress-blog"}  en_tag  vuepress-blog  {"layout":"BlogTagLayout","title":"vuepress-blog en_tag"}
/en_tag/js/             {"pid":"en_tag","id":"js"}             en_tag  js             {"layout":"BlogTagLayout","title":"js en_tag"}

Expected:

...
/en/tag/vuepress/       {"pid":"en_tag","id":"vuepress"}       en_tag  vuepress       {"layout":"BlogTagLayout","title":"vuepress en_tag"}
/en/tag/vuepress-blog/  {"pid":"en_tag","id":"vuepress-blog"}  en_tag  vuepress-blog  {"layout":"BlogTagLayout","title":"vuepress-blog en_tag"}
/en/tag/js/             {"pid":"en_tag","id":"js"}             en_tag  js             {"layout":"BlogTagLayout","title":"js en_tag"}

What does the proposed API look like?

Like Dynamic Route Matching.

How should this be implemented in your opinion?

How about modifying these lines:
https://github.com/vuepressjs/vuepress-plugin-blog/blob/c156e91cafd090aa77f64b144fe58b545e0789a3/src/node/util.ts#L25
https://github.com/vuepressjs/vuepress-plugin-blog/blob/566aa380b611f6d25ebd0000ac3552736fcd03a9/src/node/index.ts#L134

Are you willing to work on this yourself?

I want to if I can...


Sorry for bad English.

@billyyyyy3320
Copy link
Member

That makes sense. Thanks for report.😉

billyyyyy3320 pushed a commit that referenced this issue Dec 7, 2019
* feat: Support frontmatters scoped path (#39)

* fix: frontmatters scopeLayout path

* refactor: clean code
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

2 participants