fuc-new/doc/node_modules/@vuepress/plugin-seo/lib/node/utils/getLinks.js
hellcat 6adbc04d4b 1
2025-10-03 17:17:08 +08:00

14 lines
585 B
JavaScript

import { isFunction, isString } from '@vuepress/helper';
import { removeEndingSlash } from 'vuepress/shared';
import { getAlternatePaths } from './getAlternatePaths.js';
import { getUrl } from './getUrl.js';
export const getCanonicalLink = (page, canonical) => isFunction(canonical)
? canonical(page)
: isString(canonical)
? `${removeEndingSlash(canonical)}${page.path}`
: null;
export const getAlternateLinks = (app, page, hostname) => getAlternatePaths(page, app).map(({ lang, path }) => ({
lang,
path: getUrl(hostname, app.siteData.base, path),
}));