Merge pull request #1758 from umap-project/minimal-ogp
feat: add minimal OpenGraph links
This commit is contained in:
commit
e8b5331054
3 changed files with 18 additions and 0 deletions
|
@ -7,6 +7,7 @@ def settings(request):
|
||||||
return {
|
return {
|
||||||
"UMAP_FEEDBACK_LINK": djsettings.UMAP_FEEDBACK_LINK,
|
"UMAP_FEEDBACK_LINK": djsettings.UMAP_FEEDBACK_LINK,
|
||||||
"SITE_NAME": djsettings.SITE_NAME,
|
"SITE_NAME": djsettings.SITE_NAME,
|
||||||
|
"SITE_URL": djsettings.SITE_URL,
|
||||||
"ENABLE_ACCOUNT_LOGIN": djsettings.ENABLE_ACCOUNT_LOGIN,
|
"ENABLE_ACCOUNT_LOGIN": djsettings.ENABLE_ACCOUNT_LOGIN,
|
||||||
"UMAP_READONLY": djsettings.UMAP_READONLY,
|
"UMAP_READONLY": djsettings.UMAP_READONLY,
|
||||||
"UMAP_DEMO_SITE": djsettings.UMAP_DEMO_SITE,
|
"UMAP_DEMO_SITE": djsettings.UMAP_DEMO_SITE,
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
type="application/json+oembed"
|
type="application/json+oembed"
|
||||||
href="{{ oembed_absolute_uri }}?url={{ quoted_absolute_uri }}&format=json"
|
href="{{ oembed_absolute_uri }}?url={{ quoted_absolute_uri }}&format=json"
|
||||||
title="{{ map.name }} oEmbed URL" />
|
title="{{ map.name }} oEmbed URL" />
|
||||||
|
<meta property="og:url" content="{{ SITE_URL }}{{ map.get_absolute_url }}" />
|
||||||
|
<meta property="og:title" content="{{ map.name }}" />
|
||||||
|
<meta property="og:description" content="{{ map.description }}" />
|
||||||
|
<meta property="og:site_name" content="{{ SITE_NAME }}" />
|
||||||
{% endblock extra_head %}
|
{% endblock extra_head %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% block map_init %}
|
{% block map_init %}
|
||||||
|
|
|
@ -847,3 +847,16 @@ def test_oembed_link(client, map, datalayer):
|
||||||
f'?url=http%3A%2F%2Ftestserver%2Fen%2Fmap%2Ftest-map_{map.id}&format=json"'
|
f'?url=http%3A%2F%2Ftestserver%2Fen%2Fmap%2Ftest-map_{map.id}&format=json"'
|
||||||
) in response.content.decode()
|
) in response.content.decode()
|
||||||
assert 'title="test map oEmbed URL" />' in response.content.decode()
|
assert 'title="test map oEmbed URL" />' in response.content.decode()
|
||||||
|
|
||||||
|
|
||||||
|
def test_ogp_links(client, map, datalayer):
|
||||||
|
response = client.get(map.get_absolute_url())
|
||||||
|
assert response.status_code == 200
|
||||||
|
content = response.content.decode()
|
||||||
|
assert (
|
||||||
|
f'<meta property="og:url" content="http://umap.org{map.get_absolute_url()}" />'
|
||||||
|
in content
|
||||||
|
)
|
||||||
|
assert f'<meta property="og:title" content="{map.name}" />' in content
|
||||||
|
assert f'<meta property="og:description" content="{map.description}" />' in content
|
||||||
|
assert '<meta property="og:site_name" content="uMap" />' in content
|
||||||
|
|
Loading…
Reference in a new issue