From 67b42fcbfdec270aef4d83389a56d77cfef037cb Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Fri, 8 Nov 2019 21:35:47 +0100 Subject: [PATCH] - Inserted Prerendering plugin('prerender-spa-plugin') to create HTML pages (for Google... crawler) - Added Meta Tags (title, description and keywords) --- src/components/CMyPage/CMyPage.ts | 40 +++++++++++-------------------- src/model/GlobalStore.ts | 6 +++++ src/store/Modules/UserStore.ts | 2 ++ src/store/Modules/tools.ts | 19 +++++++++++++++ 4 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/components/CMyPage/CMyPage.ts b/src/components/CMyPage/CMyPage.ts index cfa5af9..84b3898 100644 --- a/src/components/CMyPage/CMyPage.ts +++ b/src/components/CMyPage/CMyPage.ts @@ -10,28 +10,15 @@ import { toolsext } from '@src/store/Modules/toolsext' import { Screen } from 'quasar' import { CImgTitle } from '../../components/CImgTitle/index' import { CTitle } from '../../components/CTitle/index' - -// Vue.use(VueScrollReveal, { -// class: 'v-scroll-reveal', // A CSS class applied to elements with the v-scroll-reveal directive; useful for animation overrides. -// duration: 1200, -// scale: 0.95, -// distance: '10px', -// rotate: { -// x: 0, -// y: 0, -// z: 0 -// } -// // mobile: true -// }) +import MixinsMetaTags from '../../mixins/mixin-metatags' @Component({ name: 'CMyPage', + mixins: [MixinsMetaTags], components: { Footer, CImgTitle, CTitle } }) export default class CMyPage extends Vue { @Prop({ required: true, default: '' }) public title: string - @Prop({ required: true, default: '' }) public keywords: string - @Prop({ required: true, default: '' }) public description: string @Prop({ required: false, default: '' }) public img: string @Prop({ required: false, default: '' }) public imgbackground: string @Prop({ required: false, default: '' }) public sizes: string @@ -39,17 +26,18 @@ export default class CMyPage extends Vue { public $t public $q - public meta() { - return { - title: this.$t('msg.myAppName'), - titleTemplate: (title) => `${this.title} - ${this.$t('msg.myAppName')}`, - meta: { - keywords: { name: 'keywords', content: this.keywords }, - description: { name: 'description', content: this.description }, - equiv: { 'http-equiv': 'Content-Type', 'content': 'text/html; charset=UTF-8' } - } - } - } + // public metaInfo() { + // return { + // // title: this.$t('msg.myAppName'), + // title: 'PROVA TITOLOOOOOOO!!!!!!!!!!!!!!!!!!!!**************************', + // titleTemplate: (title) => `${this.title} - ${this.$t('msg.myAppName')}`, + // meta: { + // keywords: { name: 'keywords', content: this.keywords }, + // description: { name: 'description', content: this.description }, + // equiv: { 'http-equiv': 'Content-Type', 'content': 'text/html; charset=UTF-8' } + // } + // } + // } public mounted() { // console.log('CMYPage title=', this.title) diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 787418e..96402e1 100644 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -47,6 +47,12 @@ export interface IConfig { value: string } +export interface IMetaTags { + title?: string + keywords?: string + description?: string +} + export interface IGlobalState { finishLoading: boolean conta: number diff --git a/src/store/Modules/UserStore.ts b/src/store/Modules/UserStore.ts index 5eda16a..804d14e 100644 --- a/src/store/Modules/UserStore.ts +++ b/src/store/Modules/UserStore.ts @@ -660,6 +660,8 @@ namespace Actions { GlobalStore.state.finishLoading = true console.log('finishLoading', GlobalStore.state.finishLoading) + // document.dispatchEvent(new Event('custom-post-render-event')) + return true // console.log('setGlobal: END') } diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index ce226f8..fb972b5 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -5,6 +5,7 @@ import { toolsext } from './toolsext' import { translation } from './translation' import Quasar, { colors, date, Screen } from 'quasar' import { scroll } from 'quasar' + const { getScrollTarget, setScrollPosition } = scroll import { @@ -2633,8 +2634,26 @@ export const tools = { return 'https://t.me/' + usertelegram else return '' + }, + metafunc(mythis) { + return { + title: mythis.$t('msg.myAppName'), + titleTemplate: (title) => `${mythis.mymeta.title} - ${mythis.$t('msg.myAppName')}`, + meta: { + keywords: { + name: 'keywords', + content: mythis.mymeta.keywords + }, + description: { + name: 'description', + content: mythis.mymeta.description + }, + equiv: { 'http-equiv': 'Content-Type', 'content': 'text/html; charset=UTF-8' } + } + } } + // getLocale() { // if (navigator.languages && navigator.languages.length > 0) { // return navigator.languages[0]