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

fix(search-pro): fix option customFields not effects #2512

Merged
merged 3 commits into from Dec 9, 2022
Merged

fix(search-pro): fix option customFields not effects #2512

merged 3 commits into from Dec 9, 2022

Conversation

init-qy
Copy link
Collaborator

@init-qy init-qy commented Dec 9, 2022

before

const entries = [
      {
        getter: (page) =>  page.frontmatter.category,
        formatter: {
          '/': '分类:$content',
          '/en/': 'Category: $content',
        },
      }
    ].map(({ formatter }, index) => formatter ? [(index.toString(), formatter)] : null).filter((item) => item !== null)
const obj = Object.fromEntries(entries);
console.log(obj); // Object { [object Object]: undefined }

after

const entries = [
      {
        getter: (page) =>  page.frontmatter.category,
        formatter: {
          '/': '分类:$content',
          '/en/': 'Category: $content',
        },
      }
    ].map(({ formatter }, index) => formatter ? [index.toString(), formatter] : null).filter((item) => item !== null)
const obj = Object.fromEntries(entries);
console.log(obj); // Object { 0: Object { /: "分类:$content", /en/: "Category: $content" } }

@@ -25,8 +25,7 @@ export default defineUserConfig({
hotReload: true,
customFields: [
{
name: "tags",
getter: ({ frontmatter }) => frontmatter.tag as string[],
getter: (page) => page.frontmatter.tag as string[],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you revert this?

@Mister-Hope Mister-Hope merged commit b8c9973 into vuepress-theme-hope:main Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants