Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getMetaTags(this: MetaTags, metaTagsOverrides: MetaTagsData): MetaTagsDefs {
// Default values.
const metaTagsData: MetaTagsData = {
type: 'article',
description: this.get('i18n').t('general.hosted_on_the_osf'),
url: pathJoin(config.OSF.url, this.get('router').get('currentURL')),
language: this.get('i18n').get('locale'),
image: pathJoin(config.OSF.url, 'static/img/preprints_assets/osf/sharing.png'),
imageType: 'image/png',
imageWidth: 1200,
imageHeight: 630,
imageAlt: this.get('i18n').t('home.brand'),
siteName: this.get('i18n').t('home.brand'),
institution: this.get('i18n').t('general.cos'),
fbAppId: config.FB_APP_ID,
twitterSite: config.social.twitter.viaHandle,
twitterCreator: config.social.twitter.viaHandle,
...metaTagsOverrides,
};
// Include URL, DOI, and any additional identifiers.
const identifiers = toArray(metaTagsData.url)
.concat(toArray(metaTagsData.doi))
.concat(toArray(metaTagsData.identifier));
return {
// Citation
citation_title: metaTagsData.title,
citation_doi: metaTagsData.doi,
citation_publisher: metaTagsData.siteName,
citation_author_institution: metaTagsData.institution,
citation_author: metaTagsData.author,
// Default values.
const metaTagsData: MetaTagsData = {
type: 'article',
description: this.get('i18n').t('general.hosted_on_the_osf'),
url: pathJoin(config.OSF.url, this.get('router').get('currentURL')),
language: this.get('i18n').get('locale'),
image: pathJoin(config.OSF.url, 'static/img/preprints_assets/osf/sharing.png'),
imageType: 'image/png',
imageWidth: 1200,
imageHeight: 630,
imageAlt: this.get('i18n').t('home.brand'),
siteName: this.get('i18n').t('home.brand'),
institution: this.get('i18n').t('general.cos'),
fbAppId: config.FB_APP_ID,
twitterSite: config.social.twitter.viaHandle,
twitterCreator: config.social.twitter.viaHandle,
...metaTagsOverrides,
};
// Include URL, DOI, and any additional identifiers.
const identifiers = toArray(metaTagsData.url)
.concat(toArray(metaTagsData.doi))
.concat(toArray(metaTagsData.identifier));
return {
// Citation
citation_title: metaTagsData.title,
citation_doi: metaTagsData.doi,
citation_publisher: metaTagsData.siteName,
citation_author_institution: metaTagsData.institution,
citation_author: metaTagsData.author,
citation_description: metaTagsData.description,
get twitterHref(this: SharingIcons): string {
const queryParams = {
url: this.hyperlink,
text: this.title,
via: config.social.twitter.viaHandle,
};
return `https://twitter.com/intent/tweet?${param(queryParams)}`;
}