Lhcfl / hexo-theme-anatolo

Anatolo,始于轻简,甄于完美
MIT License
94 stars 9 forks source link

生成的index.html中没有任何内容 #7

Closed boybeak closed 1 year ago

boybeak commented 1 year ago

github actions在执行build时报错了

=============================================
Welcome from Anatolo!
=============================================
INFO  Start processing
INFO  Files loaded in 810 ms
ERROR TypeError: /home/runner/work/boybeak.github.io/boybeak.github.io/themes/hexo-theme-anatolo/layout/partial/nav.pug:3
    1| .page-top.animated.fadeInDown
    2|   .nav
  > 3|     each cur, lst in theme.menu
    4|       li 
    5|         if is_current(cur)
    6|           a.current(href= cur)= __(lst)

Cannot read properties of undefined (reading 'length')

我的github actions代码如下:

name: Pages

on:
  push:
    branches:
      - master  # default branch

jobs:
  pages:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          # If your repository depends on submodule, please see: https://github.com/actions/checkout
          submodules: recursive
      - name: Use Node.js 18.x
        uses: actions/setup-node@v3
        with:
          node-version: '18'
      - name: Cache NPM dependencies
        uses: actions/cache@v3
        with:
          path: node_modules
          key: ${{ runner.OS }}-npm-cache
          restore-keys: |
            ${{ runner.OS }}-npm-cache
      - name: Install hexo-renderer-pug
        run: npm install hexo-renderer-pug --save
      - name: Install hexo-renderer-stylus
        run: npm install hexo-renderer-stylus --save
      - name: Install Dependencies
        run: npm install
      - name: Build
        run: npm run build
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public
boybeak commented 1 year ago

找到原因了,因为是直接clone hexo-theme-anatolo 到了themes目录了,hexo-theme-anatolo路径下的.gitignore文件中,包含了_config.yml,导致这部分内容没有被提交到github,进而在build中出现了错误