Merge pull request #2383 from wallabag/add-info-publich-articles

Added OpenGraph support for public articles
This commit is contained in:
Nicolas Lœuillet 2016-10-07 14:30:46 +02:00 committed by GitHub
commit c8d2dcdafe
13 changed files with 35 additions and 3 deletions

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
# is_public_label: 'Public' # is_public_label: 'Public'
save_label: 'Gem' save_label: 'Gem'
public:
# shared_by_wallabag: "This article has been shared by <a href=%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'Om' page_title: 'Om'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'URL' url_label: 'URL'
is_public_label: 'Öffentlich' is_public_label: 'Öffentlich'
save_label: 'Speichern' save_label: 'Speichern'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'Über' page_title: 'Über'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
is_public_label: 'Public' is_public_label: 'Public'
save_label: 'Save' save_label: 'Save'
public:
shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'About' page_title: 'About'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
is_public_label: 'Es Público' is_public_label: 'Es Público'
save_label: 'Guardar' save_label: 'Guardar'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'Acerca de' page_title: 'Acerca de'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'نشانی' url_label: 'نشانی'
is_public_label: 'عمومی' is_public_label: 'عمومی'
save_label: 'ذخیره' save_label: 'ذخیره'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'درباره' page_title: 'درباره'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
is_public_label: 'Public' is_public_label: 'Public'
save_label: 'Enregistrer' save_label: 'Enregistrer'
public:
shared_by_wallabag: "Cet article a été partagé par <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'À propos' page_title: 'À propos'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
is_public_label: 'Pubblico' is_public_label: 'Pubblico'
save_label: 'Salva' save_label: 'Salva'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'About' page_title: 'About'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
is_public_label: 'Public' is_public_label: 'Public'
save_label: 'Enregistrar' save_label: 'Enregistrar'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'A prepaus' page_title: 'A prepaus'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Adres URL' url_label: 'Adres URL'
is_public_label: 'Publiczny' is_public_label: 'Publiczny'
save_label: 'Zapisz' save_label: 'Zapisz'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'O nas' page_title: 'O nas'

View file

@ -208,6 +208,8 @@ entry:
url_label: 'Url' url_label: 'Url'
# is_public_label: 'Public' # is_public_label: 'Public'
save_label: 'Salvează' save_label: 'Salvează'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'Despre' page_title: 'Despre'

View file

@ -207,6 +207,8 @@ entry:
url_label: 'Url' url_label: 'Url'
is_public_label: 'Herkes tarafından erişime açık olsun mu?' is_public_label: 'Herkes tarafından erişime açık olsun mu?'
save_label: 'Kaydet' save_label: 'Kaydet'
public:
# shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
about: about:
page_title: 'Hakkımızda' page_title: 'Hakkımızda'

View file

@ -27,11 +27,18 @@
width: 600px; width: 600px;
} }
</style> </style>
<meta property="og:title" content="{{ entry.title | raw }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ app.request.uri }}" />
{% if entry.previewPicture is not null %}
<meta property="og:image" content="{{ entry.previewPicture }}" />
{% endif %}
</head> </head>
<body> <body>
<header> <header>
<h1>{{ entry.title | raw }}</h1> <h1>{{ entry.title | raw }}</h1>
<span><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool">{{ entry.domainName|removeWww }}</a></span> <div><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool">{{ entry.domainName|removeWww }}</a></div>
<div>{{ "entry.public.shared_by_wallabag"|trans({'%wallabag_instance%': url('homepage')})|raw }}</div>
</header> </header>
<article> <article>
{{ entry.content | raw }} {{ entry.content | raw }}

View file

@ -753,7 +753,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(2, $crawler->filter('div[class=entry]')); $this->assertCount(2, $crawler->filter('div[class=entry]'));
} }
public function testCache() public function testShareEntryPublicly()
{ {
$this->logInAs('admin'); $this->logInAs('admin');
$client = $this->getClient(); $client = $this->getClient();
@ -778,6 +778,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertContains('public', $client->getResponse()->headers->get('cache-control')); $this->assertContains('public', $client->getResponse()->headers->get('cache-control'));
$this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control'));
$this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control'));
$this->assertContains('og:title', $client->getResponse()->getContent());
$this->assertContains('og:type', $client->getResponse()->getContent());
$this->assertContains('og:url', $client->getResponse()->getContent());
// sharing is now disabled // sharing is now disabled
$client->getContainer()->get('craue_config')->set('share_public', 0); $client->getContainer()->get('craue_config')->set('share_public', 0);