mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 09:00:33 +00:00
Refactor OpenGraph tags logic
This commit is contained in:
parent
ad56024ffe
commit
290ee997b3
1 changed files with 15 additions and 14 deletions
|
@ -1,24 +1,25 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% if preview_images_enabled is True %}
|
{% firstof image site.preview_image as page_image %}
|
||||||
|
{% if page_image %}
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
{% if image %}
|
<meta name="twitter:image" content="{{ media_full_url }}{{ page_image }}">
|
||||||
<meta name="twitter:image" content="{{ media_full_url }}{{ image }}">
|
<meta name="og:image" content="{{ media_full_url }}{{ page_image }}">
|
||||||
<meta name="og:image" content="{{ media_full_url }}{{ image }}">
|
{% elif site.logo %}
|
||||||
{% else %}
|
<meta name="twitter:card" content="summary">
|
||||||
<meta name="twitter:image" content="{{ media_full_url }}{{ site.preview_image }}">
|
<meta name="twitter:image" content="{{ media_full_url }}{{ site.logo }}">
|
||||||
<meta name="og:image" content="{{ media_full_url }}{{ site.preview_image }}">
|
<meta name="twitter:image:alt" content="{{ site.name }} Logo">
|
||||||
{% endif %}
|
<meta name="og:image" content="{{ media_full_url }}{{ site.logo }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<meta name="twitter:card" content="summary">
|
<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="{% static "images/logo.png" %}">
|
||||||
<meta name="og:image" content="{% if site.logo %}{{ media_full_url }}{{ site.logo }}{% else %}{% static "images/logo.png" %}{% endif %}">
|
<meta name="twitter:image:alt" content="BookWyrm Logo">
|
||||||
|
<meta name="og:image" content="{% static "images/logo.png" %}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<meta name="twitter:image:alt" content="BookWyrm Logo">
|
|
||||||
|
|
||||||
<meta name="twitter:title" content="{% if title %}{{ title }} - {% endif %}{{ site.name }}">
|
<meta name="twitter:title" content="{% if title %}{{ title }} - {% endif %}{{ site.name }}">
|
||||||
<meta name="og: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 %}">
|
{% firstof description site.instance_tagline as description %}
|
||||||
<meta name="og:description" content="{% if description %}{{ description }}{% else %}{{ site.instance_tagline }}{% endif %}">
|
<meta name="twitter:description" content="{{ description }}">
|
||||||
|
<meta name="og:description" content="{{ description }}">
|
||||||
|
|
Loading…
Reference in a new issue