vue-i18n-routing
Advanced tools
Comparing version 0.1.6 to 0.2.0-798283f
@@ -205,2 +205,8 @@ import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
addSeoAttributes?: boolean | SeoAttributesOptions; | ||
/** | ||
* Identifier attribute of `<meta>` tag | ||
* | ||
* @defaultValue 'hid' | ||
*/ | ||
identifierAttribute?: string; | ||
} | ||
@@ -332,3 +338,3 @@ | ||
export declare function localeHead(this: RoutingProxy, { addDirAttribute, addSeoAttributes }?: I18nHeadOptions): I18nHeadMetaInfo; | ||
export declare function localeHead(this: RoutingProxy, { addDirAttribute, addSeoAttributes, identifierAttribute }?: I18nHeadOptions): I18nHeadMetaInfo; | ||
@@ -547,3 +553,3 @@ export declare function localeLocation(this: RoutingProxy, route: RawLocation | RouteLocationRaw, locale?: Locale): Location | RouteLocation | undefined; | ||
*/ | ||
export declare function useLocaleHead({ addDirAttribute, addSeoAttributes, strategy, defaultLocale, route, router, i18n }?: Pick<I18nCommonRoutingOptionsWithComposable, 'strategy' | 'defaultLocale' | 'route' | 'router' | 'i18n'> & I18nHeadOptions): Ref<I18nHeadMetaInfo>; | ||
export declare function useLocaleHead({ addDirAttribute, addSeoAttributes, identifierAttribute, strategy, defaultLocale, route, router, i18n }?: Pick<I18nCommonRoutingOptionsWithComposable, 'strategy' | 'defaultLocale' | 'route' | 'router' | 'i18n'> & I18nHeadOptions): Ref<I18nHeadMetaInfo>; | ||
@@ -550,0 +556,0 @@ /** |
@@ -675,3 +675,3 @@ var VueI18nRouting = function(exports, vueDemi, VueRouter3, vueI18nBridge) { | ||
} | ||
function localeHead({ addDirAttribute = false, addSeoAttributes = false } = {}) { | ||
function localeHead({ addDirAttribute = false, addSeoAttributes = false, identifierAttribute = "hid" } = {}) { | ||
const router = this.router; | ||
@@ -702,10 +702,10 @@ const i18n = this.i18n; | ||
} | ||
addHreflangLinks.call(this, locales, i18n.__baseUrl, metaObject.link); | ||
addCanonicalLinks.call(this, i18n.__baseUrl, metaObject.link, addSeoAttributes); | ||
addCurrentOgLocale(currentLocale, currentLocaleIso, metaObject.meta); | ||
addAlternateOgLocales(locales, currentLocaleIso, metaObject.meta); | ||
addHreflangLinks.call(this, locales, i18n.__baseUrl, metaObject.link, identifierAttribute); | ||
addCanonicalLinks.call(this, i18n.__baseUrl, metaObject.link, identifierAttribute, addSeoAttributes); | ||
addCurrentOgLocale(currentLocale, currentLocaleIso, metaObject.meta, identifierAttribute); | ||
addAlternateOgLocales(locales, currentLocaleIso, metaObject.meta, identifierAttribute); | ||
} | ||
return metaObject; | ||
} | ||
function addHreflangLinks(locales, baseUrl, link) { | ||
function addHreflangLinks(locales, baseUrl, link, identifierAttribute) { | ||
const router = this.router; | ||
@@ -733,3 +733,3 @@ const { defaultLocale, strategy } = getI18nRoutingOptions(router, this); | ||
link.push({ | ||
hid: `i18n-alt-${iso}`, | ||
[identifierAttribute]: `i18n-alt-${iso}`, | ||
rel: "alternate", | ||
@@ -745,3 +745,3 @@ href: toAbsoluteUrl(localePath2, baseUrl), | ||
link.push({ | ||
hid: "i18n-xd", | ||
[identifierAttribute]: "i18n-xd", | ||
rel: "alternate", | ||
@@ -754,3 +754,3 @@ href: toAbsoluteUrl(localePath2, baseUrl), | ||
} | ||
function addCanonicalLinks(baseUrl, link, seoAttributesOptions) { | ||
function addCanonicalLinks(baseUrl, link, identifierAttribute, seoAttributesOptions) { | ||
const route = this.route; | ||
@@ -783,3 +783,3 @@ const currentRoute = localeRoute.call(this, { | ||
link.push({ | ||
hid: "i18n-can", | ||
[identifierAttribute]: "i18n-can", | ||
rel: "canonical", | ||
@@ -790,3 +790,3 @@ href | ||
} | ||
function addCurrentOgLocale(currentLocale, currentLocaleIso, meta) { | ||
function addCurrentOgLocale(currentLocale, currentLocaleIso, meta, identifierAttribute) { | ||
const hasCurrentLocaleAndIso = currentLocale && currentLocaleIso; | ||
@@ -797,3 +797,3 @@ if (!hasCurrentLocaleAndIso) { | ||
meta.push({ | ||
hid: "i18n-og", | ||
[identifierAttribute]: "i18n-og", | ||
property: "og:locale", | ||
@@ -803,3 +803,3 @@ content: hypenToUnderscore(currentLocaleIso) | ||
} | ||
function addAlternateOgLocales(locales, currentLocaleIso, meta) { | ||
function addAlternateOgLocales(locales, currentLocaleIso, meta, identifierAttribute) { | ||
const localesWithoutCurrent = locales.filter((locale) => { | ||
@@ -811,3 +811,3 @@ const localeIso = locale.iso; | ||
const alternateLocales = localesWithoutCurrent.map((locale) => ({ | ||
hid: `i18n-og-alt-${locale.iso}`, | ||
[identifierAttribute]: `i18n-og-alt-${locale.iso}`, | ||
property: "og:locale:alternate", | ||
@@ -954,2 +954,3 @@ content: hypenToUnderscore(locale.iso) | ||
addSeoAttributes = false, | ||
identifierAttribute = "hid", | ||
strategy = void 0, | ||
@@ -984,3 +985,3 @@ defaultLocale = void 0, | ||
}, | ||
[{ addDirAttribute, addSeoAttributes }] | ||
[{ addDirAttribute, addSeoAttributes, identifierAttribute }] | ||
); | ||
@@ -1010,3 +1011,3 @@ } | ||
} | ||
const VERSION = "0.1.6"; | ||
const VERSION = "0.2.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1013,0 +1014,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
@@ -678,3 +678,3 @@ "use strict"; | ||
} | ||
function localeHead({ addDirAttribute = false, addSeoAttributes = false } = {}) { | ||
function localeHead({ addDirAttribute = false, addSeoAttributes = false, identifierAttribute = "hid" } = {}) { | ||
const router = this.router; | ||
@@ -705,10 +705,10 @@ const i18n = this.i18n; | ||
} | ||
addHreflangLinks.call(this, locales, i18n.__baseUrl, metaObject.link); | ||
addCanonicalLinks.call(this, i18n.__baseUrl, metaObject.link, addSeoAttributes); | ||
addCurrentOgLocale(currentLocale, currentLocaleIso, metaObject.meta); | ||
addAlternateOgLocales(locales, currentLocaleIso, metaObject.meta); | ||
addHreflangLinks.call(this, locales, i18n.__baseUrl, metaObject.link, identifierAttribute); | ||
addCanonicalLinks.call(this, i18n.__baseUrl, metaObject.link, identifierAttribute, addSeoAttributes); | ||
addCurrentOgLocale(currentLocale, currentLocaleIso, metaObject.meta, identifierAttribute); | ||
addAlternateOgLocales(locales, currentLocaleIso, metaObject.meta, identifierAttribute); | ||
} | ||
return metaObject; | ||
} | ||
function addHreflangLinks(locales, baseUrl, link) { | ||
function addHreflangLinks(locales, baseUrl, link, identifierAttribute) { | ||
const router = this.router; | ||
@@ -736,3 +736,3 @@ const { defaultLocale, strategy } = getI18nRoutingOptions(router, this); | ||
link.push({ | ||
hid: `i18n-alt-${iso}`, | ||
[identifierAttribute]: `i18n-alt-${iso}`, | ||
rel: "alternate", | ||
@@ -748,3 +748,3 @@ href: toAbsoluteUrl(localePath2, baseUrl), | ||
link.push({ | ||
hid: "i18n-xd", | ||
[identifierAttribute]: "i18n-xd", | ||
rel: "alternate", | ||
@@ -757,3 +757,3 @@ href: toAbsoluteUrl(localePath2, baseUrl), | ||
} | ||
function addCanonicalLinks(baseUrl, link, seoAttributesOptions) { | ||
function addCanonicalLinks(baseUrl, link, identifierAttribute, seoAttributesOptions) { | ||
const route = this.route; | ||
@@ -786,3 +786,3 @@ const currentRoute = localeRoute.call(this, { | ||
link.push({ | ||
hid: "i18n-can", | ||
[identifierAttribute]: "i18n-can", | ||
rel: "canonical", | ||
@@ -793,3 +793,3 @@ href | ||
} | ||
function addCurrentOgLocale(currentLocale, currentLocaleIso, meta) { | ||
function addCurrentOgLocale(currentLocale, currentLocaleIso, meta, identifierAttribute) { | ||
const hasCurrentLocaleAndIso = currentLocale && currentLocaleIso; | ||
@@ -800,3 +800,3 @@ if (!hasCurrentLocaleAndIso) { | ||
meta.push({ | ||
hid: "i18n-og", | ||
[identifierAttribute]: "i18n-og", | ||
property: "og:locale", | ||
@@ -806,3 +806,3 @@ content: hypenToUnderscore(currentLocaleIso) | ||
} | ||
function addAlternateOgLocales(locales, currentLocaleIso, meta) { | ||
function addAlternateOgLocales(locales, currentLocaleIso, meta, identifierAttribute) { | ||
const localesWithoutCurrent = locales.filter((locale) => { | ||
@@ -814,3 +814,3 @@ const localeIso = locale.iso; | ||
const alternateLocales = localesWithoutCurrent.map((locale) => ({ | ||
hid: `i18n-og-alt-${locale.iso}`, | ||
[identifierAttribute]: `i18n-og-alt-${locale.iso}`, | ||
property: "og:locale:alternate", | ||
@@ -957,2 +957,3 @@ content: hypenToUnderscore(locale.iso) | ||
addSeoAttributes = false, | ||
identifierAttribute = "hid", | ||
strategy = void 0, | ||
@@ -987,3 +988,3 @@ defaultLocale = void 0, | ||
}, | ||
[{ addDirAttribute, addSeoAttributes }] | ||
[{ addDirAttribute, addSeoAttributes, identifierAttribute }] | ||
); | ||
@@ -1013,3 +1014,3 @@ } | ||
} | ||
const VERSION = "0.1.6"; | ||
const VERSION = "0.2.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1016,0 +1017,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.1.6", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"test:cover": "vitest --coverage", | ||
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix" | ||
}, | ||
"version": "0.2.0-798283f", | ||
"dependencies": { | ||
@@ -118,3 +107,14 @@ "@intlify/shared": "next", | ||
}, | ||
"sideEffects": false | ||
} | ||
"sideEffects": false, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"test:cover": "vitest --coverage", | ||
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139331
3807