Add support for Mastodon link in footer

This commit is contained in:
Isaac Overacker
2022-11-12 21:26:41 -08:00
parent fff575728f
commit aafab40f68
5 changed files with 30 additions and 0 deletions

View File

@@ -55,12 +55,24 @@ export const language: string = getSiteConfig('language', 'en')
// social accounts
export const twitter: string | null = getSiteConfig('twitter', null)
export const mastodon: string | null = getSiteConfig('mastodon', null)
export const github: string | null = getSiteConfig('github', null)
export const youtube: string | null = getSiteConfig('youtube', null)
export const linkedin: string | null = getSiteConfig('linkedin', null)
export const newsletter: string | null = getSiteConfig('newsletter', null)
export const zhihu: string | null = getSiteConfig('zhihu', null)
export const getMastodonHandle = (): string | null => {
if (!mastodon) {
return null
}
// Since Mastodon is decentralized, handles include the instance domain name.
// e.g. @example@mastodon.social
const url = new URL(mastodon)
return `${url.pathname.slice(1)}@${url.hostname}`
}
// default notion values for site-wide consistency (optional; may be overridden on a per-page basis)
export const defaultPageIcon: string | null = getSiteConfig(
'defaultPageIcon',

View File

@@ -16,6 +16,7 @@ export interface SiteConfig {
newsletter?: string
youtube?: string
zhihu?: string
mastodon?: string;
defaultPageIcon?: string | null
defaultPageCover?: string | null