mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 19:48:50 +03:00
🐛 Fixed broken structured data previews
closes https://github.com/TryGhost/Ghost/issues/11385 - Updates og and twitter description to use correct fallbacks for posts/pages - Updates og and twitter description to use correct fallback for tags - Updates og and twitter title to use correct name format for tags
This commit is contained in:
parent
63ea14327a
commit
a38d7ddb19
@ -40,10 +40,10 @@ export default Component.extend(SettingsMenuMixin, {
|
|||||||
twitterTitleScratch: alias('post.twitterTitleScratch'),
|
twitterTitleScratch: alias('post.twitterTitleScratch'),
|
||||||
slugValue: boundOneWay('post.slug'),
|
slugValue: boundOneWay('post.slug'),
|
||||||
|
|
||||||
facebookDescription: or('ogDescriptionScratch', 'customExcerptScratch', 'seoDescription'),
|
facebookDescription: or('ogDescriptionScratch', 'customExcerptScratch', 'seoDescription', 'post.excerpt', 'settings.description', ''),
|
||||||
facebookImage: or('post.ogImage', 'post.featureImage'),
|
facebookImage: or('post.ogImage', 'post.featureImage'),
|
||||||
facebookTitle: or('ogTitleScratch', 'seoTitle'),
|
facebookTitle: or('ogTitleScratch', 'seoTitle'),
|
||||||
twitterDescription: or('twitterDescriptionScratch', 'customExcerptScratch', 'seoDescription'),
|
twitterDescription: or('twitterDescriptionScratch', 'customExcerptScratch', 'seoDescription', 'post.excerpt', 'settings.description', ''),
|
||||||
twitterImage: or('post.twitterImage', 'post.featureImage'),
|
twitterImage: or('post.twitterImage', 'post.featureImage'),
|
||||||
twitterTitle: or('twitterTitleScratch', 'seoTitle'),
|
twitterTitle: or('twitterTitleScratch', 'seoTitle'),
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ const {Handlebars} = Ember;
|
|||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
feature: service(),
|
feature: service(),
|
||||||
config: service(),
|
config: service(),
|
||||||
|
settings: service(),
|
||||||
|
|
||||||
tag: null,
|
tag: null,
|
||||||
scratchTag: null,
|
scratchTag: null,
|
||||||
@ -19,11 +20,11 @@ export default Component.extend({
|
|||||||
setProperty: () => {},
|
setProperty: () => {},
|
||||||
|
|
||||||
twitterTitle: or('scratchTag.twitterTitle', 'seoTitle'),
|
twitterTitle: or('scratchTag.twitterTitle', 'seoTitle'),
|
||||||
twitterDescription: or('scratchTag.twitterDescription', 'seoDescription'),
|
twitterDescription: or('scratchTag.twitterDescription', 'seoDescription', 'settings.metaDescription', ''),
|
||||||
twitterImage: or('tag.twitterImage', 'tag.featureImage'),
|
twitterImage: or('tag.twitterImage', 'tag.featureImage'),
|
||||||
|
|
||||||
facebookTitle: or('scratchTag.ogTitle', 'seoTitle'),
|
facebookTitle: or('scratchTag.ogTitle', 'seoTitle'),
|
||||||
facebookDescription: or('scratchTag.ogDescription', 'seoDescription'),
|
facebookDescription: or('scratchTag.ogDescription', 'seoDescription', 'settings.metaDescription', ''),
|
||||||
facebookImage: or('tag.ogImage', 'tag.featureImage'),
|
facebookImage: or('tag.ogImage', 'tag.featureImage'),
|
||||||
|
|
||||||
accentColor: computed('tag.accentColor', function () {
|
accentColor: computed('tag.accentColor', function () {
|
||||||
@ -48,7 +49,9 @@ export default Component.extend({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
seoTitle: computed('scratchTag.{name,metaTitle}', function () {
|
seoTitle: computed('scratchTag.{name,metaTitle}', function () {
|
||||||
let metaTitle = this.scratchTag.metaTitle || this.scratchTag.name;
|
const settingsTitle = this.get('settings.title') || '';
|
||||||
|
const tagName = settingsTitle ? `${this.scratchTag.name} - ${settingsTitle}` : this.scratchTag.name;
|
||||||
|
let metaTitle = this.scratchTag.metaTitle || tagName;
|
||||||
|
|
||||||
if (metaTitle && metaTitle.length > 70) {
|
if (metaTitle && metaTitle.length > 70) {
|
||||||
metaTitle = metaTitle.substring(0, 70).trim();
|
metaTitle = metaTitle.substring(0, 70).trim();
|
||||||
|
Loading…
Reference in New Issue
Block a user