@dreamonkey/quasar-app-extension-meta
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -1,3 +0,19 @@ | ||
export * from "./meta"; | ||
import "./i18n-shim"; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./meta"), exports); | ||
require("./i18n-shim"); | ||
//# sourceMappingURL=exports.js.map |
@@ -1,2 +0,5 @@ | ||
export function domain() { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.metaTag = exports.pageSocialMetaTags = exports.layoutSocialMetaTags = exports.domain = void 0; | ||
function domain() { | ||
// When building for SSR or SSG, it's required to provide the app domain via META_APP_DOMAIN env variable | ||
@@ -7,3 +10,4 @@ // See https://quasar.dev/quasar-cli/handling-process-env#Import-based-on-process.env | ||
} | ||
export function layoutSocialMetaTags(titleTemplateFn) { | ||
exports.domain = domain; | ||
function layoutSocialMetaTags(titleTemplateFn) { | ||
return { | ||
@@ -16,3 +20,4 @@ ...metaTag("og:title", titleTemplateFn), | ||
} | ||
export function pageSocialMetaTags(title, description, path) { | ||
exports.layoutSocialMetaTags = layoutSocialMetaTags; | ||
function pageSocialMetaTags(title, description, path) { | ||
return { | ||
@@ -24,2 +29,3 @@ ...metaTag("og:title", title), | ||
} | ||
exports.pageSocialMetaTags = pageSocialMetaTags; | ||
const html5Properties = [ | ||
@@ -32,3 +38,3 @@ "application-name", | ||
]; | ||
export function metaTag(names, valueOrTemplateFn, attributeName = "auto") { | ||
function metaTag(names, valueOrTemplateFn, attributeName = "auto") { | ||
names = typeof names === "string" ? [names] : names; | ||
@@ -54,2 +60,3 @@ const metaTagsObject = {}; | ||
} | ||
exports.metaTag = metaTag; | ||
//# sourceMappingURL=internals.js.map |
@@ -1,17 +0,22 @@ | ||
import { useMeta } from "quasar"; | ||
import { useRoute } from "vue-router"; | ||
import { layoutSocialMetaTags, pageSocialMetaTags, } from "./internals"; | ||
export function useLayoutSocialMeta(titleTemplateFn = (title) => title) { | ||
useMeta(() => ({ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.usePageSocialMeta = exports.useLayoutSocialMeta = void 0; | ||
const quasar_1 = require("quasar"); | ||
const vue_router_1 = require("vue-router"); | ||
const internals_1 = require("./internals"); | ||
function useLayoutSocialMeta(titleTemplateFn = (title) => title) { | ||
(0, quasar_1.useMeta)(() => ({ | ||
titleTemplate: titleTemplateFn, | ||
meta: layoutSocialMetaTags(titleTemplateFn), | ||
meta: (0, internals_1.layoutSocialMetaTags)(titleTemplateFn), | ||
})); | ||
} | ||
export function usePageSocialMeta(title, description) { | ||
const route = useRoute(); | ||
useMeta({ | ||
exports.useLayoutSocialMeta = useLayoutSocialMeta; | ||
function usePageSocialMeta(title, description) { | ||
const route = (0, vue_router_1.useRoute)(); | ||
(0, quasar_1.useMeta)({ | ||
title, | ||
meta: pageSocialMetaTags(title, description, route.path), | ||
meta: (0, internals_1.pageSocialMetaTags)(title, description, route.path), | ||
}); | ||
} | ||
exports.usePageSocialMeta = usePageSocialMeta; | ||
//# sourceMappingURL=meta.js.map |
@@ -1,5 +0,8 @@ | ||
import { useMeta } from "quasar"; | ||
import { useI18n } from "vue-i18n"; | ||
import { useRoute } from "vue-router"; | ||
import { domain, pageSocialMetaTags } from "./internals"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.usePageSocialMetaI18n = void 0; | ||
const quasar_1 = require("quasar"); | ||
const vue_i18n_1 = require("vue-i18n"); | ||
const vue_router_1 = require("vue-router"); | ||
const internals_1 = require("./internals"); | ||
function generateLocaleMetaTags(locale, locales) { | ||
@@ -32,7 +35,7 @@ const meta = {}; | ||
} | ||
export function usePageSocialMetaI18n(titlePathOrContent, descriptionPathOrContent, locales = []) { | ||
const route = useRoute(); | ||
const { te, t, locale } = useI18n(); | ||
const localeLinks = generateLocaleLinks(domain(), locales); | ||
useMeta(() => { | ||
function usePageSocialMetaI18n(titlePathOrContent, descriptionPathOrContent, locales = []) { | ||
const route = (0, vue_router_1.useRoute)(); | ||
const { te, t, locale } = (0, vue_i18n_1.useI18n)(); | ||
const localeLinks = generateLocaleLinks((0, internals_1.domain)(), locales); | ||
(0, quasar_1.useMeta)(() => { | ||
// Title and description could also be provided as actual content, | ||
@@ -53,3 +56,3 @@ // instead of translation path | ||
meta: { | ||
...pageSocialMetaTags(title, description, route.path), | ||
...(0, internals_1.pageSocialMetaTags)(title, description, route.path), | ||
...localeMetaTags, | ||
@@ -61,2 +64,3 @@ }, | ||
} | ||
exports.usePageSocialMetaI18n = usePageSocialMetaI18n; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,5 @@ | ||
export function domain() { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.metaTag = exports.pageSocialMetaTags = exports.layoutSocialMetaTags = exports.domain = void 0; | ||
function domain() { | ||
// When building for SSR or SSG, it's required to provide the app domain via META_APP_DOMAIN env variable | ||
@@ -7,3 +10,4 @@ // See https://quasar.dev/quasar-cli/handling-process-env#Import-based-on-process.env | ||
} | ||
export function layoutSocialMetaTags(titleTemplateFn) { | ||
exports.domain = domain; | ||
function layoutSocialMetaTags(titleTemplateFn) { | ||
return { | ||
@@ -16,3 +20,4 @@ ...metaTag("og:title", titleTemplateFn), | ||
} | ||
export function pageSocialMetaTags(title, description, path) { | ||
exports.layoutSocialMetaTags = layoutSocialMetaTags; | ||
function pageSocialMetaTags(title, description, path) { | ||
return { | ||
@@ -24,2 +29,3 @@ ...metaTag("og:title", title), | ||
} | ||
exports.pageSocialMetaTags = pageSocialMetaTags; | ||
const html5Properties = [ | ||
@@ -32,3 +38,3 @@ "application-name", | ||
]; | ||
export function metaTag(names, valueOrTemplateFn, attributeName = "auto") { | ||
function metaTag(names, valueOrTemplateFn, attributeName = "auto") { | ||
names = typeof names === "string" ? [names] : names; | ||
@@ -54,2 +60,3 @@ const metaTagsObject = {}; | ||
} | ||
exports.metaTag = metaTag; | ||
//# sourceMappingURL=internals.js.map |
{ | ||
"name": "@dreamonkey/quasar-app-extension-meta", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Automatically manage social meta tags for websites projects hooking into Quasar Meta plugin", | ||
@@ -18,5 +18,6 @@ "keywords": [ | ||
"main": "dist/exports.js", | ||
"module": "dist/esm/exports.js", | ||
"types": "dist/exports.d.ts", | ||
"scripts": { | ||
"build": "rm -rf dist i18n && tsc --declaration && tsc --project tsconfig.i18n.json", | ||
"build": "rm -rf dist i18n && tsc --declaration && tsc --project tsconfig.i18n.json && tsc --project tsconfig.esm.json", | ||
"install-build-clean": "yarn install && yarn build && rm -rf node_modules", | ||
@@ -23,0 +24,0 @@ "test": "echo \"No test specified\" && exit 0", |
@@ -225,18 +225,18 @@ # @dreamonkey/quasar-app-extension-meta | ||
{ | ||
routePath: "/it/contatti", // Relative url | ||
locale: "it", // format: [ISO 639-1 codes]-[ISO 3166-1 alpha-2] | ||
url: "/it/contatti", // Relative url | ||
}, | ||
// Only for United Kingdom | ||
{ | ||
routePath: "/en-GB/contacts", | ||
locale: "en-GB", | ||
url: "/en-GB/contacts", | ||
}, | ||
// For all other english countries | ||
{ | ||
routePath: "/en/contacts", | ||
locale: "en", | ||
url: "/en/contacts", | ||
}, | ||
{ | ||
routePath: "/fr/contacts", | ||
locale: "fr", | ||
url: "/fr/contacts", | ||
}, | ||
@@ -288,3 +288,3 @@ ]; | ||
```ts | ||
usePageSocialMetaI18n(titlePath: string, descriptionPath: string); | ||
usePageSocialMetaI18n(titlePath: string, descriptionPath: string, locales: I18nAlternateLocale[] = []); | ||
``` | ||
@@ -291,0 +291,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
43000
34
545