43 lines
1.5 KiB
Twig
43 lines
1.5 KiB
Twig
|
{% set url = safe_path('blog_menu_post', {post: post.id, slug: post.slug, _domain: _domain}) %}
|
||
|
{% set color = generate_color_by_string(post.title) %}
|
||
|
|
||
|
{%- set image -%}
|
||
|
{%- if post.image -%}
|
||
|
{{ asset(post.image)|imagine_filter('post_preview_filter') }}
|
||
|
{%- elseif post.quickImage -%}
|
||
|
{{ post.quickImage }}
|
||
|
{% else %}
|
||
|
{{ asset('build/images/post-image-logo.png') }}
|
||
|
{%- endif -%}
|
||
|
{%- endset -%}
|
||
|
|
||
|
<figure>
|
||
|
<a href="{{ url }}">
|
||
|
<img src="{{ asset('build/images/px.png') }}" data-color="{{ generate_color_by_string(post.id) }}" data-src="{{- image -}}" data-src-error="{{ asset('build/images/post-image-logo.png') }}" alt="{{ post.title }}">
|
||
|
</a>
|
||
|
</figure>
|
||
|
|
||
|
<div class="card-body">
|
||
|
<h3 class="card-title">
|
||
|
<a href="{{- url -}}">
|
||
|
{{- post.title|nbsp|raw -}}
|
||
|
</a>
|
||
|
</h3>
|
||
|
|
||
|
{% set content %}
|
||
|
{% if post.contentFormat == 'html' %}
|
||
|
{{- post.content|murph_url|file_attributes|post -}}
|
||
|
{% elseif post.contentFormat == 'markdown' %}
|
||
|
{{- post.content|murph_url|file_attributes|markdown('post')|lazy_load -}}
|
||
|
{% elseif post.contentFormat == 'editorjs' %}
|
||
|
{{- post.content|murph_url|file_attributes|editorjs_to_html|raw -}}
|
||
|
{% endif %}
|
||
|
{%- endset -%}
|
||
|
|
||
|
{% set summarySize = summarySize ?? 200 %}
|
||
|
|
||
|
{% set content = content|striptags[:summarySize] %}
|
||
|
|
||
|
<p>{{ content }}{% if content|length >= summarySize %}…{% endif %}</p>
|
||
|
</div>
|