deblan.io-murph/templates/page/post/_post_card.html.twig
Simon Vieille d3a38a1b03
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/deployment/woodpecker Pipeline failed
add posst card image
2023-01-06 13:14:42 +01:00

45 lines
1.6 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.image2 -%}
{{ asset(post.image2)|imagine_filter('post_preview_filter') }}
{%- elseif 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>