Minimal Mistakes 作品集案例页编写指南以 Baz Boom Identity 为例掌握 Collection 文档与画廊Gallery配置【免费下载链接】minimal-mistakes:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.项目地址: https://gitcode.com/gh_mirrors/mi/minimal-mistakes本篇技术指南以仓库示例文档 docs/_portfolio/baz-boom-identity.md 为核心骨架系统讲解在 Minimal Mistakes Jekyll 主题中如何为作品集PortfolioCollection 编写案例文档——从 Front Matter 元数据、header 头图、侧边栏sidebar角色信息卡到画廊gallery的完整配置与galleryinclude 的渲染机制并延伸说明归档页的 grid 展示与底层实现帮助你直接照抄出可运行的案例页。一、文档定位一份案例研究型作品集条目在 Minimal Mistakes 的官方文档站点中baz-boom-identity.md属于_portfolioCollection 的四个示例条目之一同目录还包含fizz-bang-identity.md、foo-bar-website.md、ginger-gulp-identity.md另可参见 docs/_portfolio/foo-bar-website.md 对比。它的定位是一份品牌设计案例研究Baz Boom design system涵盖 logo 设计、网站设计与品牌应用是典型的个人作品集条目写法。这份文档包含三层信息结构Front Matter 元数据页面标题、摘要excerpt、header 头图、侧边栏信息、画廊图集正文内容一段项目背景叙述该仓库示例使用占位文本实际写作时应替换为自己的项目介绍画廊调用通过{% include gallery %}将 Front Matter 中定义的图集渲染为可点击的图片网格。从仓库结构看_portfolio是被 docs/_config.yml 明确声明的 Collectioncollections: portfolio: output: true permalink: /:collection/:path/output: true表示每个条目都会生成独立页面permalink: /:collection/:path/则决定 URL 形态例如baz-boom-identity.md会输出为/portfolio/baz-boom-identity/。同时docs/_config.yml 中为portfolio类型配置了默认 Front Matterdefaults: - scope: path: type: portfolio values: layout: single author_profile: false share: true也就是说即使条目 Front Matter 不写layout也会自动套用single布局、隐藏作者侧边栏并开启分享按钮。二、Front Matter 字段逐项拆解baz-boom-identity.md的完整 Front Matter 如下--- title: Baz Boom Identity excerpt: Baz Boom design system including logo mark, website design, and branding applications. header: image: /assets/images/unsplash-gallery-image-1.jpg teaser: assets/images/unsplash-gallery-image-1-th.jpg sidebar: - title: Role image: http://placehold.it/350x250 image_alt: logo text: Designer, Front-End Developer - title: Responsibilities text: Reuters try PR stupid commenters should isnt a business model gallery: - url: /assets/images/unsplash-gallery-image-1.jpg image_path: assets/images/unsplash-gallery-image-1-th.jpg alt: placeholder image 1 - url: /assets/images/unsplash-gallery-image-2.jpg image_path: assets/images/unsplash-gallery-image-2-th.jpg alt: placeholder image 2 - url: /assets/images/unsplash-gallery-image-3.jpg image_path: assets/images/unsplash-gallery-image-3-th.jpg alt: placeholder image 3 ---1.title与excerpttitle页面与归档条目显示的主标题excerpt案例的一句话摘要。在归档列表页中它会被archive-single渲染为条目摘要。查看 _includes/archive-single.html 的源码可见其处理逻辑{% if post.excerpt %}p classarchive__item-excerpt p-summary itempropdescription{{ post.excerpt | markdownify | strip_html | truncate: 160 }}/p{% endif %}即摘要经过 Markdown 渲染、去除 HTML 后超过 160 个字符会被截断。因此给每个作品集条目写一句 160 字符以内的精炼摘要能在归档页获得最佳展示效果。2.header头图与缩略图header: image: /assets/images/unsplash-gallery-image-1.jpg teaser: assets/images/unsplash-gallery-image-1-th.jpgheader.image页面顶部的全宽头图以/开头的站点根相对路径header.teaser归档列表尤其是 grid 布局中使用的缩略图。teaser的取值优先级体现在 _includes/archive-single.html{% if post.header.teaser %} {% capture teaser %}{{ post.header.teaser }}{% endcapture %} {% elsif post.header.image %} {% assign teaser post.header.image %} {% else %} {% assign teaser site.teaser %} {% endif %}即条目自身teaser优先 → 退而取header.image→ 再退而取站点级site.teaser。所以即使不写teaser归档页也能从header.image回退获取缩略图。仓库中对应的图片资源位于 docs/assets/images/unsplash-gallery-image-1-th.jpg、docs/assets/images/unsplash-gallery-image-1.jpg 等文件。3.sidebar侧边栏信息卡sidebar: - title: Role image: http://placehold.it/350x250 image_alt: logo text: Designer, Front-End Developer - title: Responsibilities text: Reuters try PR stupid commenters should isnt a business modelsidebar接受一个数组每个元素是一张信息卡支持title、image、image_alt、text四个字段。在single布局中这组卡片会显示在页面侧边栏用于呈现角色职责等项目信息。实际使用时应把image换成自己的作品图、把text换成真实的职责描述并将示例占位文本替换掉。4.gallery画廊图集gallery: - url: /assets/images/unsplash-gallery-image-1.jpg image_path: assets/images/unsplash-gallery-image-1-th.jpg alt: placeholder image 1 - url: /assets/images/unsplash-gallery-image-2.jpg image_path: assets/images/unsplash-gallery-image-2-th.jpg alt: placeholder image 2 - url: /assets/images/unsplash-gallery-image-3.jpg image_path: assets/images/unsplash-gallery-image-3-th.jpg alt: placeholder image 3每个图集项包含三个字段url点击缩略图后跳转的大图地址image_path在页面上显示的缩略图路径alt图片替代文本兼顾可访问性与 SEO。三、画廊渲染原理galleryinclude 源码解读正文中通过一行 Liquid 调用画廊{% include gallery captionThis is a sample gallery to go along with this case study. %}其渲染逻辑位于 _includes/gallery无扩展名的 Liquid 模板。核心源码如下{% if include.id %} {% assign gallery page[include.id] %} {% else %} {% assign gallery page.gallery %} {% endif %} {% if include.layout %} {% assign gallery_layout include.layout %} {% else %} {% if gallery.size 2 %} {% assign gallery_layout half %} {% elsif gallery.size 3 %} {% assign gallery_layout third %} {% else %} {% assign gallery_layout %} {% endif %} {% endif %} figure class{{ gallery_layout }} {{ include.class }} {% for img in gallery %} {% if img.url %} a href{{ img.url | relative_url }} {% if img.title %}title{{ img.title | escape_once }}{% endif %} img src{{ img.image_path | relative_url }} alt{% if img.alt %}{{ img.alt | escape_once }}{% endif %} /a {% else %} img src{{ img.image_path | relative_url }} alt{% if img.alt %}{{ img.alt | escape_once }}{% endif %} {% endif %} {% endfor %} {% if include.caption %} figcaption{{ include.caption | markdownify | remove: p | remove: /p }}/figcaption {% endif %} /figure由此可以总结出画廊 include 的完整使用规则1. 图集来源id参数不带id时默认渲染page.gallery带id时如{% include gallery idgallery2 %}渲染page.gallery2这允许一个页面配置多套图集用不同 id 分别调用。2. 布局layout参数与自动推断显式传layout如layouthalf时优先使用否则自动推断图集 2 张用half半幅、3 张及以上用third三列、少于 2 张则不附加布局类class参数可追加自定义 CSS 类。3. 渲染细节每个图集项若有url缩略图被包裹为超链接并支持可选的title属性经escape_once转义图片src与链接href均经relative_url过滤器处理兼容站点部署在子路径下的场景alt同样经escape_once转义caption支持 Markdown输出前会剥离包裹的p标签。baz-boom-identity 示例配置了 3 张图因此自动采用third三列布局缩略图各自链接到大图页面上展示为一行三列的图集。四、作品集归档页从条目到 grid 列表baz-boom-identity.md这类条目最终由归档页汇总展示。仓库中的归档页是 docs/_pages/portfolio-archive.md--- title: Portfolio layout: collection permalink: /portfolio/ collection: portfolio entries_layout: grid classes: wide --- Sample document listing for the collection _portfolio.关键字段layout: collection使用 Collection 归档布局collection: portfolio指定要罗列的 Collectionentries_layout: grid以网格形式展示条目对应baz-boом等条目的header.teaser缩略图网格。collection布局的底层实现在 _layouts/collection.html{% assign entries_layout page.entries_layout | default: list %} div classentries-{{ entries_layout }} {% include documents-collection.html localelocale collectionpage.collection sort_bypage.sort_by sort_orderpage.sort_order typeentries_layout %} /div它通过documents-collectioninclude 按sort_by/sort_order排序后把每个条目的标题、摘要与缩略图渲染为列表list或网格grid卡片。网格模式下的缩略图输出逻辑在 _includes/archive-single.html{% if include.type grid and teaser %} div classarchive__item-teaser img src{{ teaser | relative_url }} alt /div {% endif %}即 grid 模式才会显示teaser缩略图——这也是为什么作品集条目都推荐配置header.teaser的原因。五、将示例改造为自己的作品集条目将baz-boom-identity.md的写法迁移到自己的项目核心步骤为复制结构新建_portfolio/your-project.md保留title、excerpt、header、sidebar、gallery等 Front Matter 键替换资源路径把header.image、header.teaser、gallery各项的url/image_path换成自己仓库assets/images/下的真实图片注意示例中的http://placehold.it/350x250为占位图地址实际应替换为本地资源填写真实正文将示例中的占位文本替换为自己的项目背景、设计过程与成果说明按需调整画廊少于 3 张图会自动切换布局或通过{% include gallery idxxx layouthalf %}显式控制确认归档可见性确保_config.yml中已声明portfolioCollection含output: true并在归档页layout: collection中指定collection: portfolio。完成以上改造后your-project.md即可生成独立的案例详情页并自动出现在/portfolio/归档网格中与仓库自带的四个示例条目保持一致的展示效果。六、小结本示例文档揭示了什么baz-boom-identity.md虽然是一份以占位文本构成的示例文档但它完整示范了 Minimal Mistakes 作品集场景的三项核心能力Collection 驱动的独立条目页Front Matter 元数据 single布局默认值docs/_config.yml自动组合成案例详情页galleryinclude 的声明式图集通过 YAML 数组声明图片、自动推断布局、支持多图集与自定义布局源码见 _includes/gallery归档网格的缩略图链路header.teaser→archive-singlegrid 分支 → 归档页网格形成从条目到列表的完整闭环。对于需要搭建个人作品集或项目案例展示站的开发者直接对照本文第三节的字段说明与第五节的改造步骤就能把这份示例快速落地为自己的真实作品集页面。【免费下载链接】minimal-mistakes:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.项目地址: https://gitcode.com/gh_mirrors/mi/minimal-mistakes创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
企业数字化 ERP 产品动态
相关推荐
Escrcpy 快速上手指南:从 USB 到无线连接与 Gnirehtet 反向网络共享 桌面应用移动开发开发工具 【免费下载链接】escrcpy 优雅而强大的跨平台 Android 设备控制工具,基于 Scrcpy 的 Electron 应用,支持无线连接和多设备管理,让您的电脑成为 Android 的完美伴侣。 项目地址: https://gitcode.com/viarotel-org/escrcpy 点击… · 2026/9/23 21:27:39
OTN物理层接口标准ITU-T G.959.1解析:光模块选型与参数校验实战 简介:ITU-T G.959.1-2018是国际电信联盟发布的关于光传送网(OTN)物理层接口的推荐标准,面向光传输系统设计、网络规划与运维人员,以及通信技术研究者。该版本在原规范基础上新增了FOIC2.4(200G四通道&#… · 2026/9/23 21:27:38
AI搜索监测平台怎么选?主流服务商对比评测与GEO选型建议 摘要选择AI搜索监测服务商,核心应看数据独立性、监测维度、证据可追溯性和GEO行动支持四个维度。综合评估,BUGOOAI布谷作为独立第三方AI搜索监测平台,适合品牌方优先评估;Semrush适合已有海外SEO体系的团队,Otterly.ai… · 2026/9/23 22:03:03
广州表导生文化课补习哪家靠谱|弱基础冲刺机构盘点 广州表演、编导类艺考考生长期专注专业课集训,文化课复习周期短、知识断层明显、整体基础偏弱,且表导专业对文化课分数线要求处于中等偏上水平,适配这类学情的正规补习机构更看重文科适配教学与精细化分层辅导。结合广州本地机构办学合规性、… · 2026/9/23 22:02:57
分位数回归实战:从统计原理到PyQt工程落地 简介:本资源是一套基于Python与PyQt5开发的分位数回归分析完整项目,面向统计建模初学者、经济学/金融学专业学生及毕业设计、课程设计实践者,解决传统均值回归无法刻画条件分布异质性的问题,覆盖分位数Granger因果检验、分位数VAR… · 2026/9/23 22:02:50
一个月从零到四项目:AI编程起步路线图与项目纪律系统 1. 一个月从零到四项目:我的AI编程起步路线图1.1 为什么选择AI编程作为切入点说实话,我并不是计算机科班出身,之前写过的“代码”仅限于Excel里录几个公式。真正让我下决心动手的契机,是发现身边好几个做产品的朋友开始用AI工具直… · 2026/9/23 22:02:50
奥迪A6(C7/C8)故障诊断与维修方案梳理:发动机、变速箱、底盘、电气全分项 武汉地区奥迪A6/A6L维修,可参考志华车改 auto club(势奥联盟武汉站,武昌区江盛路39号)的处理体系。门店15年只做奥迪,为一汽奥迪授权商、势奥联盟会长单位,约700平方米车间多工位可同时容纳6台以上车辆&… · 2026/9/23 22:02:50
3招搞定手机怎么下载微信面试难题实战项目解析 3招搞定手机怎么下载微信面试难题实战项目解析 面试被问“手机怎么下载微信”背后的原理,90%的人答不上来。别笑,这看似弱智的问题,实则是考察你对移动应用分发机制、安全校验及网络协议理解的试金石。我带过不少校招新人,他们背了八股文,却连一个A… · 2026/9/23 0:00:03
你有新短消息请注意查收:3个新手避坑指南搞定消息系统选型 你有新短消息请注意查收:3个新手避坑指南搞定消息系统选型 面试被问“高并发下如何保证消息不丢失”,你张口就是“用Redis”,结果面试官追问“如果Redis宕机了怎么办”,你瞬间卡壳。这种场景太常见了,很多新手在背八股文时,只记住了技术名词… · 2026/9/23 0:00:29