markdown 发布带图像的循环

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 发布带图像的循环相关的知识,希望对你有一定的参考价值。

Within the `index.php`, ensure you have something like:
```
$context['posts'] = Timber::get_posts();
```

Within the .twig template file, referenced in the above:
```
{% if posts is defined and posts is not empty %}
	<div class="vert-push--small vert-push--teen--medium l-grid c-blog-item__set  c-std">
		{% for post in posts %}
			<div class="l-grid__item infant--one-half adult--one-third c-std">
				{% include 'components/blog/item/template.twig' with {"post": post} %}
			</div>
		{% endfor %}
	</div>
{% endif %}
```

And finally within the individual blog item template file:
```
{% if classes %}
	{% set class = classes|join(" ") %}
{% endif %}

<a href="{{ post.post_name }}" class="c-blog-item 
	{% if class is defined and class is not empty %} {{ class }}{% endif %}
">
	
	{% if post.ImageClass is defined and post.ImageClass is not empty %}
		{{ TimberImage(post.thumbnail.id) }}
		<div class="c-blog-item__image" style="background-image: url({{ TimberImage(item_project.thumbnail.id ) }})"></div>
	{% endif %}
	
	
	<div class="c-blog-item__content">

		{% if post.post_title is defined and post.post_title is not empty %}
			<div class="c-blog-item__title">
				<h2>{{ post.post_title }}</h2>
			</div>
		{% endif %}

		{% if post.post_date is defined and date is not empty %}
			<div class="c-blog-item__date">
				{{ post.post_date }}
			</div>
		{% endif %}

		{% if post.post_excerpt is defined and post.post_excerpt is not empty %}
			<div class="c-blog-item__excerpt">
				{{ post.post_excerpt }}
			</div>
		{% endif %}

		{% if category is defined and category is not empty %}
			<div class="c-blog-item__category">
				{{ category }}
			</div>
		{% endif %}
	
	</div>
</a>
```

以上是关于markdown 发布带图像的循环的主要内容,如果未能解决你的问题,请参考以下文章

UNITY发布带obb的安卓apk

如何发布带静态资源的库——android 篇

44.curl发布带body的post请求

node-red 发布带请求参数的接口

将图像链接发送到电报而不显示图像 url

在 R Markdown 文件中包含 HTML 文件?