222 lines
8.7 KiB
Twig
222 lines
8.7 KiB
Twig
{% set full = full is defined and full %}
|
|
|
|
<div class="col-12">
|
|
<div class="body">
|
|
{% if post.isQuick %}
|
|
<div class="quick">
|
|
{% set image = null %}
|
|
|
|
{% if post.quickImage %}
|
|
{% set image = post.quickImage %}
|
|
{% elseif post.image %}
|
|
{% set image = asset(post.image) %}
|
|
{% endif %}
|
|
|
|
{% set url = post.quickUrl %}
|
|
{% set title = post.title %}
|
|
{% set content = post.content %}
|
|
|
|
{% if false and post.quickVideo and post.quickVideoHeight and post.quickVideoWidth %}
|
|
<div class="quick-video">
|
|
<div class="video-ratio" data-ratio="{{ post.quickVideoHeight * 100 / post.quickVideoWidth }}%">
|
|
<iframe src="{{ post.quickVideo }}" allowfullscreen></iframe>
|
|
</div>
|
|
</div>
|
|
{% elseif image %}
|
|
<div class="quick-image">
|
|
<a href="{{ url }}" target="_blank">
|
|
<img src="{{ asset('build/images/px.png') }}" data-src="{{ image }}" alt="{{ title }}" title="{{ title }}">
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="quick-body">
|
|
<h2 class="h4 no-margin">
|
|
<a href="{{ url }}" target="_blank">
|
|
{{- title -}}
|
|
</a>
|
|
</h2>
|
|
|
|
<p class="no-margin">
|
|
<a href="{{ url }}" target="_blank">{{ url }}</a>
|
|
</p>
|
|
|
|
{% if post.contentFormat == 'html' %}
|
|
{{- post.content|post -}}
|
|
{% endif %}
|
|
|
|
{% if post.contentFormat == 'markdown' %}
|
|
{{- post.content|markdown('post') -}}
|
|
{% endif %}
|
|
|
|
{% if not full %}
|
|
<p>
|
|
<a href="{{ safe_path('blog_menu_post', {post: post.id, slug: post.slug}) }}">
|
|
{{- 'Lien permanent' -}}
|
|
</a>
|
|
</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
{% if not full %}
|
|
<h2 class="h2 no-margin">
|
|
<a href="{{ safe_path('blog_menu_post', {post: post.id, slug: post.slug}) }}">
|
|
{{- post.title -}}
|
|
</a>
|
|
</h2>
|
|
|
|
<ul class="list--inline no-margin">
|
|
<li>
|
|
<time datetime="{{ post.publishedAt|date("Y-m-d") }}" title="{{ post.publishedAt|date("r") }}">
|
|
{{- 'Le ' ~ post.publishedAt|date("d/m/Y à H\\hi") -}}
|
|
</time>
|
|
</li>
|
|
{% for category in post.categories %}
|
|
<li>
|
|
<a href="{{ safe_path('blog_menu_category', {category: category.id, slug: category.slug}) }}">
|
|
{{- category.title -}}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
|
|
{% for tag in post.tags %}
|
|
<li>
|
|
<a href="{{ safe_path('blog_menu_search', {tag: tag.label}) }}">
|
|
{{- '#' ~ tag.label -}}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
<div class="body-content">
|
|
{% if post.contentFormat == 'html' %}
|
|
{{- post.content|post -}}
|
|
{% endif %}
|
|
|
|
{% if post.contentFormat == 'markdown' %}
|
|
{{- post.content|markdown('post')|lazy_load -}}
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% if full %}
|
|
<div class="col-12">
|
|
<div class="reviews">
|
|
<hr>
|
|
|
|
{% set comments = post.comments({
|
|
isActive: true,
|
|
isFirstLevel: true
|
|
}) %}
|
|
|
|
{% if comments|length %}
|
|
<div class="grid">
|
|
{% for comment in comments %}
|
|
{{ include('blog/post/_comment.html.twig', {comment: comment, level: 1}) }}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="grid" id="form">
|
|
<form class="form col-12" method="POST" data-form-bot action="{{ safe_url('blog_tech_form_without_javascript', {page: app.request.uri}) }}">
|
|
{% if comments|length %}
|
|
<hr>
|
|
{% endif %}
|
|
|
|
<div class="h4">Ajouter un commentaire</div>
|
|
|
|
<div class="row">
|
|
<div class="field col-6">
|
|
{{ form_label(form.author) }}
|
|
{{ form_widget(form.author) }}
|
|
{{ form_errors(form.author) }}
|
|
</div>
|
|
<div class="field col-6">
|
|
{{ form_label(form.website) }}
|
|
{{ form_widget(form.website) }}
|
|
{{ form_errors(form.website) }}
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="field col-12">
|
|
{{ form_label(form.email) }}
|
|
{{ form_widget(form.email) }}
|
|
{{ form_errors(form.email) }}
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<p class="no-margin">
|
|
{{- 'Votre commentaire - Vous pouvez utiliser du markdown ' }}
|
|
[<a title="Afficher l'aide" href="{{ safe_path('blog_tech_mardown') }}" target="_blank">?</a>]
|
|
</p>
|
|
|
|
{{ form_errors(form.content) }}
|
|
|
|
{{ form_widget(form.content, {attr: {cols: 30, rows: 10}}) }}
|
|
|
|
<div class="hidden alert alert-notice-light" id="answer-alert">
|
|
<div class="grid">
|
|
<div class="col-9">
|
|
{{- 'Vous répondez à un commentaire' -}}
|
|
</div>
|
|
<div class="col-3 align-right">
|
|
<a href="#" id="cancel-answer">
|
|
<span class="button small">
|
|
{{- 'Annuler' -}}
|
|
</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<input type="checkbox" id="rgpd" required>
|
|
<label for="rgpd">En validant ce formulaire, vous acceptez que les données saisies seront publiées sur cette page à l'exception de votre e-mail.</label>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<input type="submit" class="button" value="Publier" />
|
|
<input type="button" class="button alt preview-button" value="Prévisualiser" />
|
|
</div>
|
|
|
|
{{ form_rest(form) }}
|
|
</form>
|
|
|
|
<div id="preview" class="review-body col-12"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if not post.isQuick %}
|
|
{%
|
|
set ld = {
|
|
'@context': 'http://schema.org/',
|
|
'@type': 'BlogPosting',
|
|
'headline': post.title,
|
|
'author': {
|
|
'@type': 'Person',
|
|
'name': 'Simon Vieille'
|
|
},
|
|
'publisher': {
|
|
'@type': 'Organization',
|
|
'name': 'Deblan blog',
|
|
'logo': {
|
|
'@type': 'imageObject',
|
|
'url': asset('build/images/logo.png')
|
|
}
|
|
},
|
|
'datePublished': post.publishedAt|date("c"),
|
|
'dateModified': post.updatedAt|date("c"),
|
|
'image': post.image ? asset(post.image) : null
|
|
}
|
|
%}
|
|
|
|
<script type="application/ld+json">{{- ld|json_encode(128)|replace({'\\/': '/'})|raw -}}</script>
|
|
{% endif %}
|
|
{% endif %}
|