Jekyll 生成后不需要的_posts结构
我的存储库中有当前结构:Jekyll 生成后不需要的_posts结构,jekyll,github-pages,Jekyll,Github Pages,我的存储库中有当前结构: ./_posts/2018-07-01-A-Post.md ./_posts/2018-07-01-Another-Post.md ./modules/A_Module/_posts/2018-07-01-A-Third-Post.md 上述所有文件都有以下内容: --- layout: article permalink: /article/:categories/:title title: A Post date: 2018-07-
./_posts/2018-07-01-A-Post.md
./_posts/2018-07-01-Another-Post.md
./modules/A_Module/_posts/2018-07-01-A-Third-Post.md
上述所有文件都有以下内容:
---
layout: article
permalink: /article/:categories/:title
title: A Post
date: 2018-07-01 12:00:00
categories: Announcement
thumbnail:
author: lipkau
tags:
- Release
---
/modules/A_Module
是加载了.gitmodules
的子模块,“第三篇文章”保存在该存储库中
我想要的是,所有的帖子都以完全相同的方式显示。但事实证明我错了。这是/\u站点
中的结果:
./_site/article/announcement/A-Post.html
./_site/article/announcement/Another-Post.html <--- all good so far
./_site/modules/A_Module/announcement/A-Thrid-Post.html <--- why did this happen?
这里是我的.gitmodules
:
[submodule "modules/JiraPS"]
path = modules/JiraPS
url = https://github.com/AtlassianPS/JiraPS.git
branch = master
我必须如何更改文件,以便我可以在不同的存储库中维护帖子,但仍然与其他帖子具有相同的结构?
我希望第三篇文章出现,但不是https://.../article/modules/A_Module/announcement/A-Third-Post
而是https://.../article/announcement/A-Third-Post
感谢您的帮助更新答案: 最快、最简单的修复方法是在文档的前端对永久链接进行硬编码。您已经为每个文档指定了永久链接,因此这不应该是一个障碍。但是,由于
modules
是一个自定义集合,因此不应使用像:article
这样的变量,而应像这样对其进行硬编码:
永久链接:/article/announcement/A-post
尽管可以在permalink中使用:categories
变量,但仍然不应该使用,因为这可以是数组,而不一定是字符串
或者(如果不使用URL重写:
permalink:/article/announcement/A-post.html
我不希望git忽略该目录。我希望第三篇文章出现,但不是以https://.../article/modules/A_Module/announcement/A-Third-Post
而是https://.../article/announcement/A-Third-Post
谢谢你,基思。我试过了,没什么变化。我也不明白为什么你这么重要与我的不同(permalink:/article/:categories/:title
)模块是一个集合吗?你能粘贴你的配置文件吗?添加到OP中
[submodule "modules/JiraPS"]
path = modules/JiraPS
url = https://github.com/AtlassianPS/JiraPS.git
branch = master