1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 09:19:59 +00:00

Add simple OG metadata tags to templates

Hello, #185
This commit is contained in:
TheAMM 2017-05-26 01:03:59 +03:00
parent 3bd4898a65
commit 3f49f17baa
8 changed files with 39 additions and 0 deletions

View file

@ -1,5 +1,8 @@
{% extends "layout.html" %}
{% block title %}404 Not Found :: {{ config.SITE_NAME }}{% endblock %}
{% block metatags %}
<meta property="og:description" content="Nothing here.">
{% endblock %}
{% block body %}
<h1>404 Not Found</h1>
<p>The path you requested does not exist on this server.</p>

View file

@ -1,5 +1,12 @@
{% extends "layout.html" %}
{% block title %}{% if search.term %}{{ search.term | e}}{% else %}Browse{% endif %} :: {{ config.SITE_NAME }}{% endblock %}
{% block metatags %}
{% if search.term %}
<meta property="og:description" content="Search for '{{ search.term }}'">
{% else %}
<meta property="og:description" content="{{ config.SITE_NAME }} homepage">
{% endif %}
{% endblock %}
{% block body %}
{% if search["term"] == '' %}

View file

@ -11,6 +11,13 @@
<link rel="mask-icon" href="/static/pinned-tab.svg" color="#3582F7">
<link rel="alternate" type="application/rss+xml" href="{% if rss_filter %}{{ url_for('home', page='rss', _external=True, **rss_filter) }}{% else %}{{ url_for('home', page='rss', _external=True) }}{% endif %}" />
<meta property="og:site_name" content="{{ config.SITE_NAME }}">
<meta property="og:title" content="{{ self.title() }}">
<meta property="og:image" content="{% block meta_image %}/static/img/avatar/default.png{% endblock %}">
{% block metatags %}
{# Filled by children #}
{% endblock %}
<!-- Bootstrap core CSS -->
<!--
Note: This has been customized at http://getbootstrap.com/customize/ to

View file

@ -1,5 +1,8 @@
{% extends "layout.html" %}
{% block title %}Login :: {{ config.SITE_NAME }}{% endblock %}
{% block metatags %}
<meta property="og:description" content="Log in to {{ config.SITE_NAME }}!">
{% endblock %}
{% block body %}
{% from "_formhelpers.html" import render_field %}

View file

@ -1,5 +1,8 @@
{% extends "layout.html" %}
{% block title %}Register :: {{ config.SITE_NAME }}{% endblock %}
{% block metatags %}
<meta property="og:description" content="Register to {{ config.SITE_NAME }}!">
{% endblock %}
{% block body %}
{% from "_formhelpers.html" import render_field %}

View file

@ -1,5 +1,8 @@
{% extends "layout.html" %}
{% block title %}Upload Torrent :: {{ config.SITE_NAME }}{% endblock %}
{% block metatags %}
<meta property="og:description" content="Upload a torrent to {{ config.SITE_NAME }}">
{% endblock %}
{% block body %}
{% from "_formhelpers.html" import render_field %}
{% from "_formhelpers.html" import render_upload %}

View file

@ -1,5 +1,14 @@
{% extends "layout.html" %}
{% block title %}{{ user.username }} :: {{ config.SITE_NAME }}{% endblock %}
{% block meta_image %}{{ user.gravatar_url() }}{% endblock %}
{% block metatags %}
{% if search.term %}
<meta property="og:description" content="Search for '{{ search.term }}' in torrents uploaded by {{ user.username }}">
{% else %}
<meta property="og:description" content="Torrents uploaded by {{ user.username }}">
{% endif %}
{% endblock %}
{% block body %}
{% from "_formhelpers.html" import render_menu_with_button %}

View file

@ -1,5 +1,9 @@
{% extends "layout.html" %}
{% block title %}{{ torrent.display_name }} :: {{ config.SITE_NAME }}{% endblock %}
{% block metatags %}
{% set uploader_name = torrent.user.username if (torrent.user and not torrent.anonymous) else 'Anonymous' %}
<meta property="og:description" content="{{ category_name(torrent.sub_category.id_as_string) }} | {{ torrent.filesize | filesizeformat(True) }} | Uploaded by {{ uploader_name }} on {{ torrent.created_time.strftime('%Y-%m-%d') }}">
{% endblock %}
{% block body %}
{% from "_formhelpers.html" import render_field %}
<div class="panel panel-{% if torrent.deleted %}deleted{% elif torrent.remake %}danger{% elif torrent.trusted %}success{% else %}default{% endif %}">