You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Pages构建失败:Jekyll::Page无yaml_file?方法报错

解决GitHub Pages构建错误:undefined method 'yaml_file?' for Jekyll::Page

问题简述

维护的GitHub Pages仓库仅修改了index.md内容,构建时报错:

github-pages 230 | Error: undefined method `yaml_file?' for #<Jekyll::Page @name="01-platform-description.md">

错误触发于页面摘要(excerpt)渲染环节,当前环境为github-pages v230、Jekyll 3.9.5,使用primer主题。

可行解决方案

  • 修正页面Front Matter:确保01-platform-description.md开头包含合法的Front Matter标记(用---包裹,即使内容为空),Jekyll依赖该标记识别摘要分隔逻辑。示例:
    ---
    ---
    页面正文内容...
    
  • 关闭自动摘要生成:在_config.yml中添加全局配置,禁用自动摘要功能:
    excerpt_separator: ""
    
    或在目标页面的Front Matter中手动设置空摘要:
    ---
    excerpt: ""
    ---
    
  • 切换兼容主题:当前使用的jekyll-theme-primer 0.6.0可能与Jekyll 3.9.5存在方法调用冲突,可尝试更换为GitHub Pages支持的其他主题(如minimal),修改_config.yml的theme字段:
    theme: jekyll-theme-minimal
    
  • 本地调试定位:本地安装对应版本的github-pages依赖,执行bundle exec jekyll build,可更直观地定位触发错误的具体代码逻辑,便于针对性修复。

内容的提问来源于stack exchange,提问作者Brooke Gibbons

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 04:20:17