Browse Source

Open Graph tags: use full url, add description

It seems like the absolute url (without domain) is making the image not
render in Twitter cards, and lack of a description is making some of the
embeds look strange. We'll add a default description for now and look to
override this soon.
merge-requests/64/head
Deimos 6 years ago
parent
commit
e22881be0d
  1. 2
      tildes/tildes/__init__.py
  2. 3
      tildes/tildes/templates/base.jinja2

2
tildes/tildes/__init__.py

@ -47,6 +47,8 @@ def main(global_config: Dict[str, str], **settings: str) -> PrefixMiddleware:
config.add_tween("tildes.http_method_tween_factory") config.add_tween("tildes.http_method_tween_factory")
config.add_tween("tildes.metrics_tween_factory") config.add_tween("tildes.metrics_tween_factory")
config.add_static_view("images", "/images")
config.add_request_method(is_safe_request_method, "is_safe_method", reify=True) config.add_request_method(is_safe_request_method, "is_safe_method", reify=True)
# Add the request.redis request method to access a redis connection. This is done in # Add the request.redis request method to access a redis connection. This is done in

3
tildes/tildes/templates/base.jinja2

@ -11,11 +11,12 @@
<meta name="intercoolerjs:use-data-prefix" content="true"> <meta name="intercoolerjs:use-data-prefix" content="true">
<meta name="csrftoken" content="{{ get_csrf_token() }}"> <meta name="csrftoken" content="{{ get_csrf_token() }}">
<meta property="og:image" content="/images/tildes-logo-144x144.png">
<meta property="og:image" content="{{ request.static_url("/images/tildes-logo-144x144.png") }}">
<meta property="og:site_name" content="Tildes"> <meta property="og:site_name" content="Tildes">
<meta property="og:type" content="website"> <meta property="og:type" content="website">
{% block meta_og_tags %} {% block meta_og_tags %}
<meta property="og:title" content="{{ self.title() }}"> <meta property="og:title" content="{{ self.title() }}">
<meta property="og:description" content="Tildes: a non-profit community site">
{% endblock %} {% endblock %}
{# Hardcoding each option isn't great, but I don't know a better method #} {# Hardcoding each option isn't great, but I don't know a better method #}

Loading…
Cancel
Save