0

这个问题之后,我发现有一个名为shortcodes的插件在这里可能会有所帮助。

我已经安装了插件并创建了一个新页面:

---
title: slide1
media_order: slider1.jpeg
taxonomy:
    category:
        - 'Home Slider'
process:
    markdown: true
    twig: true
routable: false
cache_enable: false
visible: false
---

[section name="slide_title"]
Precisión y Calidad
[/section]

[section name="slide_subtitle"]
La máxima calidad y seguridad para nuestros clientes
[/section]

[section name="slide_link"]
www.google.es
[/section]

然后我有一个调用的部分,它使得:

{% for slide in taxonomy.findTaxonomy({'category': 'Home Slider'}) %}
    <span>TEST</span>
    <span>{{ slide.title }}</span>
    <span>{{ slide.shortcode.section.slide_title }}</span>
    <span>{{ slide.shortcode.section.slide_subtitle }}</span>
    <span>{{ slide.shortcode.section.slide_link }}</span>
{% endfor %}

但这只会产生:

TEST
slide1 

并且它不输出简码部分内容。

4

1 回答 1

1

当您不直接处理page变量时,您链接到的文档显示了正确的语法:

{{ slide.contentMeta.shortcodeMeta.shortcode.section.slide_title }}
{{ slide.contentMeta.shortcodeMeta.shortcode.section.slide_subtitle }}
{{ slide.contentMeta.shortcodeMeta.shortcode.section.slide_link }}
于 2018-02-21T18:45:33.713 回答