0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

fix(twitter-card): use proper image tag (#7025)

This commit is contained in:
Gergely Nemeth 2016-06-30 02:04:43 +02:00 committed by Austin Burdine
parent 204e99b331
commit 447cc0cd2e
3 changed files with 11 additions and 11 deletions

View file

@ -24,7 +24,7 @@ function getStructuredData(metaData) {
'twitter:title': metaData.metaTitle,
'twitter:description': metaData.metaDescription || metaData.excerpt,
'twitter:url': metaData.canonicalUrl,
'twitter:image:src': metaData.coverImage,
'twitter:image': metaData.coverImage,
'twitter:label1': metaData.authorName ? 'Written by' : undefined,
'twitter:data1': metaData.authorName,
'twitter:label2': metaData.keywords ? 'Filed under' : undefined,

View file

@ -38,7 +38,7 @@ describe('getStructuredData', function () {
'twitter:data1': 'Test User',
'twitter:data2': ['one', 'two', 'tag'].join(', '),
'twitter:description': 'Post meta description',
'twitter:image:src': 'http://mysite.com/content/image/mypostcoverimage.jpg',
'twitter:image': 'http://mysite.com/content/image/mypostcoverimage.jpg',
'twitter:label1': 'Written by',
'twitter:label2': 'Filed under',
'twitter:title': 'Post Title',

View file

@ -94,7 +94,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:title" content="Ghost" \/>/);
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/blog-cover.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/blog-cover.png" \/>/);
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/testurl.com\/rss\/" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
@ -148,7 +148,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
rendered.string.should.match(/<meta name="twitter:description" content="all about our blog" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/about\/" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/test-image-about.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/test-image-about.png" \/>/);
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/testurl.com\/rss\/" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
@ -191,7 +191,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:title" content="tag meta title" \/>/);
rendered.string.should.match(/<meta name="twitter:description" content="tag meta description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/tag\/tagtitle\/" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/tag-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/tag-image.png" \/>/);
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/testurl.com\/rss\/" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
@ -232,7 +232,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:title" content="tagtitle - Ghost" \/>/);
rendered.string.should.match(/<meta name="twitter:description" content="tag description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/tag\/tagtitle\/" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/tag-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/tag-image.png" \/>/);
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/testurl.com\/rss\/" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
@ -321,7 +321,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:description" content="Author bio" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/author\/AuthorName\/" \/>/);
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/author-cover-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/author-cover-image.png" \/>/);
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/testurl.com\/rss\/" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
@ -423,7 +423,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost" \/>/);
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/post\/" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/test-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/test-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
rendered.string.should.match(/"@type": "Article"/);
@ -502,7 +502,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:description" content="blog &quot;test&quot; description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/post\/" \/>/);
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/test-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/test-image.png" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
rendered.string.should.match(/"@type": "Article"/);
@ -574,7 +574,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost" \/>/);
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/post\/" \/>/);
rendered.string.should.match(/<meta name="twitter:image:src" content="http:\/\/testurl.com\/content\/images\/test-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/testurl.com\/content\/images\/test-image.png" \/>/);
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
@ -650,7 +650,7 @@ describe('{{ghost_head}} helper', function () {
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/testurl.com\/post\/" \/>/);
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
rendered.string.should.not.match(/<meta name="twitter:image:src"/);
rendered.string.should.not.match(/<meta name="twitter:image"/);
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
rendered.string.should.match(/"@type": "Article"/);