Добавление блока социальных кнопок [closes #32]

master
Антон Касимов 2019-05-18 00:13:09 +03:00
parent 46318a04b4
commit d82fbb0f00
5 changed files with 36 additions and 17 deletions

View File

@ -5,16 +5,16 @@
<subtitle type="html">{{subtitle}}</subtitle> <subtitle type="html">{{subtitle}}</subtitle>
{%- endif %} {%- endif %}
<link rel="self" href="{{request.path_qs}}"/> <link rel="self" href="{{request.path_qs}}"/>
{%- if alternate %} {%- if 'links' in feed and feed['index'] %}
<link rel="alternate" type="text/html" hreflang="{{request.locale_name}}" href="{{alternate}}"/> <link rel="alternate" type="text/html" hreflang="{{request.locale_name}}" href="{{feed['links']['index']}}"/>
{%- endif %} {%- endif %}
<updated>{{(pages[0][1].page['updated'] or pages[0][1].page['published']).isoformat()}}+00:00</updated> <updated>{{(pages[0][1].page['updated'] or pages[0][1].page['published']).isoformat()}}+00:00</updated>
<id>urn:uuid:{{id}}</id> <id>urn:uuid:{{feed['id']}}</id>
<author> <author>
<name>{{author['name']}}</name> <name>{{feed['author']['name']}}</name>
</author> </author>
{%- if category %} {%- if feed['category'] %}
<category term="{{category}}"/> <category term="{{feed['category']}}"/>
{%- endif %} {%- endif %}
<generator uri="https://trac.radium.group/flatfilecms/" version="1.0">flatfilecms</generator> <generator uri="https://trac.radium.group/flatfilecms/" version="1.0">flatfilecms</generator>
{%- for item in pages %} {%- for item in pages %}

View File

@ -2,19 +2,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{request.locale_name}}"> <html lang="{{request.locale_name}}">
<head> <head>
{% block head -%} {%- block head %}
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{description}}"> <meta name="description" content="{{description}}">
<meta name="generator" content="flatfilecms"> <meta name="generator" content="flatfilecms">
<link rel="icon" type="image/png" href="/static/img/favicon.png"> <link rel="icon" type="image/png" href="/static/img/favicon.png">
{% if amphtml is defined -%} {%- if amphtml is defined %}
<link rel="amphtml" href="{{amphtml}}"> <link rel="amphtml" href="{{amphtml}}">
{% endif -%} {%- endif %}
{% for link in alternate -%} {%- if feed is defined %}
<link rel="alternate" type="{{link.type}}" title="{{link.title}}" href="{{link.href}}"> <link rel="alternate" type="application/atom+xml" title="Atom feed" href="{{feed['links']['atom']}}">
{% endfor -%} {%- endif %}
<title>{{title}}</title> <title>{{title}}</title>
{% block links %} {% block links %}
{%- endblock %} {%- endblock %}

View File

@ -1,5 +1,5 @@
{% extends "layout.jinja2" %} {% extends "layout.jinja2" %}
{% if header_class is not defined %}{% set header_class="light" %}{%endif%} {%- if header_class is not defined %}{% set header_class="light" %}{%endif%}
{% block content %} {% block content %}
<div class="card-columns"> <div class="card-columns">
{% for item in pages %} {% for item in pages %}
@ -17,8 +17,4 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% set atom_feed = alternate|selectattr('type', 'equalto', 'application/atom+xml')|first -%}
{% if atom_feed -%}
<p>Подписаться на обновления: <a href="{{atom_feed.href}}"><i class="fas fa-rss"></i></a></p>
{% endif -%}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,22 @@
{%- if feed is defined and 'links' in feed %}
<div class="text-center mb-4">
<p>Лента сообщений в удобном формате:</p>
<div class="btn-group" role="group" aria-label="Feed links">
{%- if 'index' in feed['links'] %}
<a href="{{feed['links']['index']}}" class="btn btn-secondary" role="button"><i class="fas fa-newspaper"></i></a>
{%- endif %}
{%- if 'atom' in feed['links'] %}
<a href="{{feed['links']['atom']}}" class="btn btn-secondary" role="button"><i class="fas fa-rss"></i></a>
{%- endif %}
{%- if 'twitter' in feed['links'] %}
<a href="https://twitter.com/{{feed['links']['twitter']}}" class="btn btn-secondary" role="button"><i class="fab fa-twitter"></i></a>
{%- endif %}
{%- if 'telegram' in feed['links'] %}
<a href="https://t.me/{{feed['links']['telegram']}}" class="btn btn-secondary" role="button"><i class="fab fa-telegram"></i></a>
{%- endif %}
{%- if 'facebook' in feed['links'] %}
<a href="https://fb.me/{{feed['links']['facebook']}}" class="btn btn-secondary" role="button"><i class="fab fa-facebook"></i></a>
{%- endif %}
</div>
</div>
{%- endif %}

View File

@ -20,6 +20,7 @@
{% endblock %} {% endblock %}
</article> </article>
</main> </main>
{%- include 'feedlinks.jinja2' %}
<footer class="page-footer"> <footer class="page-footer">
{% include "footer.jinja2" %} {% include "footer.jinja2" %}
</footer> </footer>