mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-26 14:32:04 -04:00
[head] add missing descriptions
This commit is contained in:
parent
36e9f87d41
commit
00b1447600
@ -34,6 +34,7 @@
|
||||
head() {
|
||||
return head({
|
||||
title: this.title,
|
||||
description: this.intro,
|
||||
banner: this.img,
|
||||
});
|
||||
},
|
||||
|
@ -267,6 +267,7 @@
|
||||
head() {
|
||||
return head({
|
||||
title: this.$t('census.headerLong'),
|
||||
description: this.$t('census.description')[0],
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -221,6 +221,7 @@
|
||||
head() {
|
||||
return head({
|
||||
title: `@${this.username}`,
|
||||
description: this.profile ? this.profile.description : null,
|
||||
banner: `api/banner/@${this.username}.png`,
|
||||
});
|
||||
},
|
||||
|
@ -139,6 +139,11 @@
|
||||
head() {
|
||||
return this.selectedPronoun ? head({
|
||||
title: `${this.$t('pronouns.intro')}: ${this.selectedPronoun.name(this.glue)}`,
|
||||
description: [
|
||||
this.$t('pronouns.examples', {}, false),
|
||||
this.$t('pronouns.grammarTable', {}, false),
|
||||
this.$t('sources.headerLong', {}, false),
|
||||
].filter(x => !!x).join(', '),
|
||||
banner: `api/banner${this.$route.path.replace(/\/$/, '')}.png`,
|
||||
}) : {};
|
||||
},
|
||||
|
@ -175,6 +175,7 @@
|
||||
head() {
|
||||
return head({
|
||||
title: this.$t('sources.headerLonger'),
|
||||
description: this.$t('sources.subheader'),
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
@ -127,6 +127,7 @@
|
||||
head() {
|
||||
return head({
|
||||
title: this.$t('contact.team.name'),
|
||||
description: this.$t('contact.team.description'),
|
||||
});
|
||||
},
|
||||
async asyncData({app}) {
|
||||
|
@ -32,6 +32,7 @@ export const head = ({title, description, banner}) => {
|
||||
|
||||
if (description) {
|
||||
description = clearLinkedText(description);
|
||||
description = description.split(' ').slice(0, 24).join(' ') + '…';
|
||||
meta.meta.push({ hid: 'description', name: 'description', content: description });
|
||||
meta.meta.push({ hid: 'og:description', property: 'og:description', content: description });
|
||||
meta.meta.push({ hid: 'twitter:description', property: 'twitter:description', content: description });
|
||||
@ -207,6 +208,8 @@ export const clearLinkedText = (text, quotes = true) => {
|
||||
text = text.replace(/[„”"']/g, '');
|
||||
}
|
||||
|
||||
text = text.replace(/\s+/g, ' ');
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,17 @@ export default async function parseMarkdown(markdown) {
|
||||
const title = titleMatch ? titleMatch[1] : null;
|
||||
const imgMatch = content.match('<img src="([^"]+)"[^>]*>');
|
||||
const img = imgMatch ? imgMatch[1] : null;
|
||||
let intro = [];
|
||||
for (let introMatch of content.matchAll('<p[^>]*>([^<]+)</p>')) {
|
||||
const p = introMatch[1].replace(/(<([^>]+)>)/ig, '').replace(/\s+/g, ' ');
|
||||
intro = [...intro, ...p.split(' ')];
|
||||
}
|
||||
|
||||
return {
|
||||
content,
|
||||
title,
|
||||
img,
|
||||
intro: intro.length ? intro.slice(0, 24).join(' ') : null,
|
||||
content,
|
||||
}
|
||||
} catch {
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user