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

添加frontMatter部署失败 #101

Open
86196831 opened this issue Oct 21, 2024 · 1 comment
Open

添加frontMatter部署失败 #101

86196831 opened this issue Oct 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@86196831
Copy link

你当前使用的Elog版本

0.14.2

Elog配置文件

// 导出配置
module.exports = {
  // 写入配置
  write: {
    // 平台为yuque
    platform: 'notion',
    // notion
    notion: {
      // 从环境变量中获取token
      token: process.env.NOTION_TOKEN,
      // 从环境变量中获取数据库ID
      databaseId: process.env.NOTION_DATABASE_ID,
      // 过滤条件
      filter: false, // {property: 'status', select: {equals: '已发布'}}
      catalog: true,
      },
    
  },
  // 部署配置
  deploy: {
    // 平台为local
    platform: 'local',
    local: {
      // 输出目录为./docs
      outputDir: './posts',
      // 文件名为title
      filename: 'title',
      // 格式为markdown
      format: 'matter-markdown',
      filter: true, // 表示将按照表中的【status】字段进行过滤,保留所有【已发布】的文档
      catalog: true,
      frontMatter: {
        enable: true,
        include: ['title', 'tags', 'categories', 'date', 'description'],
      }
    },
    
  },
  // 图片配置
  image: {
    // 是否启用
    enable: false,
    // 平台为local
    platform: 'local',
    local: {
      // 输出目录为./docs/images
      outputDir: './docs/images',
      // 前缀key为/images
      prefixKey: '/images',
      // 是否路径跟随文档
      pathFollowDoc: false,
    },
    // oss配置
    oss: {
      // 从环境变量中获取secretId
      secretId: process.env.OSS_SECRET_ID,
      // 从环境变量中获取secretKey
      secretKey: process.env.OSS_SECRET_KEY,
      // 从环境变量中获取bucket
      bucket: process.env.OSS_BUCKET,
      // 从环境变量中获取region
      region: process.env.OSS_REGION,
      // 从环境变量中获取host
      host: process.env.OSS_HOST,
      // 前缀key为空
      prefixKey: '',
    },
    // cos配置
    cos: {
      // 从环境变量中获取secretId
      secretId: process.env.COS_SECRET_ID,
      // 从环境变量中获取secretKey
      secretKey: process.env.COS_SECRET_KEY,
      // 从环境变量中获取bucket
      bucket: process.env.COS_BUCKET,
      // 从环境变量中获取region
      region: process.env.COS_REGION,
      // 从环境变量中获取host
      host: process.env.COS_HOST,
      // 前缀key为空
      prefixKey: '',
    },
    // qiniu配置
    qiniu: {
      // 从环境变量中获取secretId
      secretId: process.env.QINIU_SECRET_ID,
      // 从环境变量中获取secretKey
      secretKey: process.env.QINIU_SECRET_KEY,
      // 从环境变量中获取bucket
      bucket: process.env.QINIU_BUCKET,
      // 从环境变量中获取region
      region: process.env.QINIU_REGION,
      // 从环境变量中获取host
      host: process.env.QINIU_HOST,
      // 前缀key为空
      prefixKey: '',
    },
    // upyun配置
    upyun: {
      // 从环境变量中获取user
      user: process.env.UPYUN_USER,
      // 从环境变量中获取password
      password: process.env.UPYUN_PASSWORD,
      // 从环境变量中获取bucket
      bucket: process.env.UPYUN_BUCKET,
      // 从环境变量中获取host
      host: process.env.UPYUN_HOST,
      // 前缀key为空
      prefixKey: '',
    },
    // github配置
    github: {
      // 从环境变量中获取token
      token: process.env.GITHUB_TOKEN,
      // 从环境变量中获取user
      user: process.env.ELOG_GITHUB_USER,
      // 从环境变量中获取repo
      repo: process.env.ELOG_GITHUB_REPO,
      // 前缀key为空
      prefixKey: '',
    }
  }
}

发生了什么?

notion同步到Vitepress。
只要一加frontMatter,就部署失败,去掉就正常
{386A3384-2A23-468E-BD56-C7C7CA1AD200}
{0C61358B-3563-4972-BCF4-227CCB29D930}

Elog错误日志

build error:
item.categories.forEach is not a function
TypeError: item.categories.forEach is not a function
    at file:///vercel/path0/.vitepress/config.mjs.timestamp-1729493016991-3dffd1af6004b.mjs:211:23
    at Array.forEach (<anonymous>)
    at getAllCategories (file:///vercel/path0/.vitepress/config.mjs.timestamp-1729493016991-3dffd1af6004b.mjs:209:13)
    at file:///vercel/path0/.vitepress/config.mjs.timestamp-1729493016991-3dffd1af6004b.mjs:747:23
 ELIFECYCLE  Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1

附加信息

No response

@86196831 86196831 added the bug Something isn't working label Oct 21, 2024
@LetTTGACO
Copy link
Owner

notion 数据库文档中并不存在 categories 字段,如果不需要这个字段可以在 include 中删除此字段

Repository owner deleted a comment Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants