yosymfony/spress-plugin-more-tag

Spress 网站中文章的更多标签

安装: 150

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

开放问题: 1

类型:spress-plugin

v2.0.0 2016-01-02 12:29 UTC

This package is auto-updated.

Last update: 2024-09-13 04:37:01 UTC


README

Spress 2 ready

您可以使用 more 标签 来获取内容摘要,例如博客条目。

此插件需要 Spress >= 2.0。如果您正在使用 Spress 1.x,请转到插件的 1.0.1 版本。

如何安装?

转到您的 Spress 网站,并在您的 composer.json 中添加以下内容,然后运行 composer update

"require": {
    "yosymfony/spress-plugin-more-tag": "2.0.*"
}

如何使用?

在 Markdown 语法中,您可以使用 --more----more <你的更多标签>--,例如 `--more 更多信息--` 来获取博客条目的摘要。在 more 标签 之前的内容将被视为摘要。more 标签需要在末尾有一个新行。

这是 错误的

Your main text
--more-- Explain text

模板端

此插件提供了一些 Twig 过滤器和一项测试来处理摘要相关的问题

  • excerpt 过滤器获取内容的摘要。 {{ post.content | excerpt }}
  • content 过滤器获取不带 more 标签文本的内容。 {{ post.content | content }}
  • excerpt_label 过滤器获取与 more 标签文本关联的标签。
  • with_excerpt 测试允许您检查一个变量是否包含 more 标签文本。

示例

---
layout: default
---

Hello and welcome to **Spress, a static site generator capable to generate
blogs sites**.

--more--

Your post can be write in Markdown and your templates are
writing with [Twig](http://twig.sensiolabs.org/documentation).

示例 2

---
layout: default
---

Hello and welcome to **Spress, a static site generator capable to generate
blogs sites**.

--more More information--

Your post can be write in Markdown and your templates are
writing with [Twig](http://twig.sensiolabs.org/documentation).