mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-08 16:25:27 +00:00
Merge pull request #2593 from asmaloney/opengraph
Move all opengraph (/twitter) metadata into one template
This commit is contained in:
commit
ba5d0f1b14
6 changed files with 25 additions and 29 deletions
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
{% block title %}{{ book|book_title }}{% endblock %}
|
{% block title %}{{ book|book_title }}{% endblock %}
|
||||||
|
|
||||||
{% block opengraph_images %}
|
{% block opengraph %}
|
||||||
{% include 'snippets/opengraph_images.html' with image=book.preview_image %}
|
{% include 'snippets/opengraph.html' with image=book.preview_image %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
{% load feed_page_tags %}
|
{% load feed_page_tags %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block opengraph_images %}
|
{% block opengraph %}
|
||||||
|
{% firstof status.book status.mention_books.first as book %}
|
||||||
{% firstof status.book status.mention_books.first as book %}
|
{% if book %}
|
||||||
{% if book %}
|
{% include 'snippets/opengraph.html' with image=preview %}
|
||||||
{% include 'snippets/opengraph_images.html' with image=preview %}
|
{% else %}
|
||||||
{% else %}
|
{% include 'snippets/opengraph.html' %}
|
||||||
{% include 'snippets/opengraph_images.html' %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,4 +42,3 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -15,20 +15,9 @@
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="{% if site.favicon %}{% get_media_prefix %}{{ site.favicon }}{% else %}{% static "images/favicon.ico" %}{% endif %}">
|
<link rel="shortcut icon" type="image/x-icon" href="{% if site.favicon %}{% get_media_prefix %}{{ site.favicon }}{% else %}{% static "images/favicon.ico" %}{% endif %}">
|
||||||
<link rel="apple-touch-icon" href="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
<link rel="apple-touch-icon" href="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
||||||
|
|
||||||
{% if preview_images_enabled is True %}
|
{% block opengraph %}
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
{% include 'snippets/opengraph.html' %}
|
||||||
{% else %}
|
|
||||||
<meta name="twitter:card" content="summary">
|
|
||||||
{% endif %}
|
|
||||||
<meta name="twitter:title" content="{% if title %}{{ title }} - {% endif %}{{ site.name }}">
|
|
||||||
<meta name="og:title" content="{% if title %}{{ title }} - {% endif %}{{ site.name }}">
|
|
||||||
<meta name="twitter:description" content="{{ site.instance_tagline }}">
|
|
||||||
<meta name="og:description" content="{{ site.instance_tagline }}">
|
|
||||||
|
|
||||||
{% block opengraph_images %}
|
|
||||||
{% include 'snippets/opengraph_images.html' %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<meta name="twitter:image:alt" content="BookWyrm Logo">
|
|
||||||
|
|
||||||
{% block head_links %}{% endblock %}
|
{% block head_links %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
{% include 'user/books_header.html' with shelf=shelf %}
|
{% include 'user/books_header.html' with shelf=shelf %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block opengraph_images %}
|
{% block opengraph %}
|
||||||
{% include 'snippets/opengraph_images.html' with image=user.preview_image %}
|
{% include 'snippets/opengraph.html' with image=user.preview_image %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% if preview_images_enabled is True %}
|
{% if preview_images_enabled is True %}
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
{% if image %}
|
{% if image %}
|
||||||
<meta name="twitter:image" content="{{ media_full_url }}{{ image }}">
|
<meta name="twitter:image" content="{{ media_full_url }}{{ image }}">
|
||||||
<meta name="og:image" content="{{ media_full_url }}{{ image }}">
|
<meta name="og:image" content="{{ media_full_url }}{{ image }}">
|
||||||
|
@ -9,6 +10,15 @@
|
||||||
<meta name="og:image" content="{{ media_full_url }}{{ site.preview_image }}">
|
<meta name="og:image" content="{{ media_full_url }}{{ site.preview_image }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
<meta name="twitter:image" content="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
<meta name="twitter:image" content="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
||||||
<meta name="og:image" content="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
<meta name="og:image" content="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<meta name="twitter:image:alt" content="BookWyrm Logo">
|
||||||
|
|
||||||
|
<meta name="twitter:title" content="{% if title %}{{ title }} - {% endif %}{{ site.name }}">
|
||||||
|
<meta name="og:title" content="{% if title %}{{ title }} - {% endif %}{{ site.name }}">
|
||||||
|
|
||||||
|
<meta name="twitter:description" content="{% if description %}{{ description }}{% else %}{{ site.instance_tagline }}{% endif %}">
|
||||||
|
<meta name="og:description" content="{% if description %}{{ description }}{% else %}{{ site.instance_tagline }}{% endif %}">
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
{% block title %}{{ user.display_name }}{% endblock %}
|
{% block title %}{{ user.display_name }}{% endblock %}
|
||||||
|
|
||||||
{% block opengraph_images %}
|
{% block opengraph %}
|
||||||
{% include 'snippets/opengraph_images.html' with image=user.preview_image %}
|
{% include 'snippets/opengraph.html' with image=user.preview_image %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
Loading…
Reference in a new issue