如何在Jekyll中使用markdownify来显示索引摘录 [英] How do I use markdownify in Jekyll to show an excerpt on the index

查看:116
本文介绍了如何在Jekyll中使用markdownify来显示索引摘录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望显示索引页面上较长文章或页面的简短文本摘录.我打算在前件"中使用自定义变量并抓取该变量,但是随后我看到了.excerpt

I'm looking to show a short excerpt of text from a longer post or page on the index page. I was going to use a custom variable in the Front Matter and grab that, but then I saw the filter for .excerpt

我在 Jekyll文档中看到了一个名为{{ page.excerpt | markdownify }}的东西,我该如何标记页面上的降价或发布到为了使用该过滤器?

I see in the Jekyll docs there's something called {{ page.excerpt | markdownify }} How would I markup the markdown on a page or post in order to use that filter?

还是markdownify占用整个.md文件?

edit: Or does markdownify take the entire .md document?

推荐答案

在发布降价文件中,您需要首先设置摘录,这是我发布的帖子中的一个示例

In the post markdown files you need to first set your excerpt, here is an example from one of my posts

layout: post
title: A developers toolkit
date: Friday 14 December, 2012
excerpt: What text editor to use? Sass or plain old CSS? What on earth is Compass? Command    line? I'm not touching that. Sound like you? Welcome, I was once like you and this is the guide I wish someone had given me.

然后在索引页面上调用标签

Then on the index page call the tag

{{ post.excerpt }}

然后这应该输出您在markdown文件中写的内容.简洁明了,为什么我爱杰基尔.

This should then output what you have wrote in the markdown file. Nice and simple and why I love Jekyll.

这篇关于如何在Jekyll中使用markdownify来显示索引摘录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆