问题描述
我在博客中使用Jekyll。我想用密码保护某些博客文章,因此决定使用Staticrypt。
我可以使用Staticryp CLI和自定义index.html
对我的一篇博客文章的password_template.html
页面进行加密。输出index_encrypted.html
。
我的问题是:index_encrypted.html
放在哪里?我无法将其添加到_site
中,因为每次我提供服务时,Jekyll都会将该版本恢复为默认版本。
我尝试将index_encrypted.html
添加到_includes
文件夹,并从.md
帖子中调用页面,如下所示:
{% include index_encrypted.html %}
,但这只会中断页面。
谢谢!
解决方法
我想出了办法。
这就是我所做的:
-
将
index_encrypted.html
放入_includes
和_layouts
-
在您要定位的
permalink: /index_encrypted.html
帖子前面添加.md
。 -
在您要定位的
layout: index_encrypted
帖子前面添加.md
。 -
删除
.md
帖子的整个markdown内容。 -
Voila!
您的前件应该看起来像这样:
---
title:
date:
tags:
description:
layout: index_encrypted
permalink: "/index_encrypted.html"
---
编辑:请确保为您的.md
帖子创建一个副本,以备后用。