add: view и шаблоны для блогов и страниц
This commit is contained in:
58
etpgrf_site/blog/templates/blog/post_detail.html
Normal file
58
etpgrf_site/blog/templates/blog/post_detail.html
Normal file
@@ -0,0 +1,58 @@
|
||||
{% extends 'typograph/base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ post.seo_title|default:post.title }} — ETPGRF{% endblock %}
|
||||
{% block description %}{{ post.seo_description|default:post.excerpt|default:post.content|striptags|truncatechars:160 }}{% endblock %}
|
||||
{% block og_title %}{{ post.seo_title|default:post.title }}{% endblock %}
|
||||
{% block og_description %}{{ post.seo_description|default:post.excerpt|default:post.content|striptags|truncatechars:160 }}{% endblock %}
|
||||
{% block og_image %}{% if post.image %}{{ request.scheme }}://{{ request.get_host }}{{ post.image.url }}{% else %}{{ request.scheme }}://{{ request.get_host }}{% static 'img/etpgrf-logo-for-fb-vk-x.gif' %}{% endif %}{% endblock %}
|
||||
{% block twitter_title %}{{ post.seo_title|default:post.title }}{% endblock %}
|
||||
{% block twitter_description %}{{ post.seo_description|default:post.excerpt|default:post.content|striptags|truncatechars:160 }}{% endblock %}
|
||||
{% block twitter_image %}{% if post.image %}{{ request.scheme }}://{{ request.get_host }}{{ post.image.url }}{% else %}{{ request.scheme }}://{{ request.get_host }}{% static 'img/etpgrf-logo-for-fb-vk-x.gif' %}{% endif %}{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
|
||||
{# Левая колонка: Дата и Картинка #}
|
||||
<div class="col-lg-2 align-self-start text-end mb-4">
|
||||
<p class="small align-self-end">
|
||||
<small class="bg-secondary bg-opacity-10 p-2 text-nowrap">
|
||||
{{ post.published_at|date:"d.M.Y"|lower }}
|
||||
</small>
|
||||
</p>
|
||||
<p>
|
||||
{% if post.image %}
|
||||
<img src="{{ post.image.url }}" class="w-100 rounded" alt="{{ post.title }}" />
|
||||
{% else %}
|
||||
<img src="{% static 'img/etpgrf-logo-for-fb-vk-x.gif' %}" class="w-100 rounded opacity-50" alt="{{ post.title }}" />
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<div class="d-none d-lg-block mt-5">
|
||||
<a href="{% url 'blog:post_list' %}" class="btn btn-sm btn-outline-secondary w-100">← В блог</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Правая колонка: Контент #}
|
||||
<div class="col-lg-10 border-start ps-lg-4">
|
||||
|
||||
<h1 class="display-4 mb-4">{{ post.title }}</h1>
|
||||
|
||||
{% if post.excerpt %}
|
||||
<p class="lead bg-secondary bg-opacity-10 p-3 rounded">
|
||||
{{ post.excerpt|linebreaksbr }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="post-content mt-4">
|
||||
{{ post.content|safe }}
|
||||
</div>
|
||||
|
||||
<div class="d-lg-none mt-5 border-top pt-3">
|
||||
<a href="{% url 'blog:post_list' %}" class="btn btn-outline-secondary">← Назад к списку статей</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user