如何获得页面文件名,减去Jekyll中的扩展名(即basename)?
对于我的Jekyll站点,我在每个页面上生成BibTeX代码,以便于引用。当前,我的模板如下所示:如何获得页面文件名,减去Jekyll中的扩展名(即basename)?,jekyll,Jekyll,对于我的Jekyll站点,我在每个页面上生成BibTeX代码,以便于引用。当前,我的模板如下所示: <code> % BibTeX Code % Copy and paste the following code into your .bib file to cite this article: @online{ title="{{ page.title | escape }}", author="{{ page.author
<code>
% BibTeX Code
% Copy and paste the following code into your .bib file to cite this article:
@online{
title="{{ page.title | escape }}",
author="{{ page.author | escape }}",
organization="{{ site.title | escape }}",
date="{{ page.date | date: "%Y-%m-%d" }}",
urldate="{{ site.time | date: "%Y-%m-%d" }}",
url="<!-- website domain name here -->{{page.url}}"
}
</code>
%BibTeX码
%将以下代码复制并粘贴到.bib文件中以引用本文:
@在线{
title=“{page.title | escape}}”,
author=“{page.author | escape}}”,
organization=“{site.title | escape}}”,
date=“{page.date | date:%Y-%m-%d”},
urldate=“{site.time | date:%Y-%m-%d”}”,
url=“{page.url}}”
}
这里只有一个问题:对于那些知道BibTeX的人来说,我遗漏了一个条目名。就在我的代码中的where后面,上面写着
@online{
,我需要一个条目名,用于引用BibTeX数据库中的条目。现在,这有一定的限制,例如它不能包含空格。事实上,Jekyll生成的HTML文件的名称将是完美的。但是,我不清楚如何仅获取此名称。液体模板{page.url}
将生成类似于/2017/02/22/my page.html的内容,但我只需要我的页面
您正在查找slug
属性:
文档文件名中的Slugified标题(除
数字和字母替换为连字符)
将打印
my-page
您正在查找slug
属性:
文档文件名中的Slugified标题(除
数字和字母替换为连字符)
将打印
my-page