vuepress / create-vuepress

Scaffolding out a VuePress docs, blog, repro repo or other interesting things
MIT License
67 stars 12 forks source link

Feature/fix blog scaffold config #6

Closed billyyyyy3320 closed 5 years ago

billyyyyy3320 commented 5 years ago

I was confused when I used blog scaffold for first time. Although some example articles was already contained in _posts folder, I could't view any posts but 404.

I'm not sure whether the issue has been solved or not, but I believe the code below cause error:

// config.js
// ...
    /**
     * Ref: https://vuepress-theme-blog.ulivz.com/#modifyblogpluginoptions
     * Workaround of https://github.com/ulivz/vuepress-plugin-blog/issues/1
     */
    modifyBlogPluginOptions(blogPlugnOptions) {
      const archiveDirectoryClassifierIndex = blogPlugnOptions.directories.findIndex(d => d.id === 'archive')
      blogPlugnOptions.directories.splice(archiveDirectoryClassifierIndex, 1)
      return blogPlugnOptions
    },
// ...

I can't see any object with id 'archive' in source code:

// theme-blog/index.js
  const defaultBlogPluginOptions = {
    directories: [
      {
        id: 'post',
        dirname: '_posts',
        path: '/',
        // layout: 'IndexPost', defaults to `Layout.vue`
        itemLayout: 'Post',
        itemPermalink: '/:year/:month/:day/:slug',
        pagination: {
          lengthPerPage: 5,
        },
      },
    ],
    frontmatters: [
      {
        id: "tag",
        keys: ['tag', 'tags'],
        path: '/tag/',
        // layout: 'Tag',  defaults to `FrontmatterKey.vue`
        frontmatter: { title: 'Tag' },
        pagination: {
          lengthPerPage: 5
        }
      },
    ]
billyyyyy3320 commented 5 years ago

And I fix a typo by the way.