我刚刚安装了Jekyll,我正在追随几个问题.我知道您在根目录中的.md文件中定义了内容,并根据您选择的布局文件生成了html文件,但我没有得到的是如何分割您的内容{{ content }}.
比方说我想要一个来自我的.md文件的内容<article>和另一个内容我将<aside>如何进行此操作?有问题的代码粘贴在下面.谢谢
.md文件
---
layout: page
title: Page Test
permalink: /page-test/
bodyclass: page-test
---
Article content
* Hey this is my content!
Aside content
* Test links
Run Code Online (Sandbox Code Playgroud)
布局文件
---
layout: default
---
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
</header>
<article class="post-content">
{{ content }}
</article>
<aside>
</aside>
</div>
Run Code Online (Sandbox Code Playgroud)
您可以使用该post.excerpt功能.
_config.yml
excerpt_separator: "<!--more-->"
Run Code Online (Sandbox Code Playgroud)
岗位
---
frontmatter
---
Excerpt text
<!--more-->
Body text
....
Run Code Online (Sandbox Code Playgroud)
布局
---
layout: default
---
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
</header>
<article class="post-content">
{% assign contentArray = page.content | markdownify | split: site.excerpt_separator %}
{{ contentArray.last }}
</article>
<aside>
{{ contentArray.first }}
</aside>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1383 次 |
| 最近记录: |