added metainfo title on each pages
This commit is contained in:
+5
-1
@@ -40,7 +40,11 @@ export default {
|
|||||||
// if no subcomponents specify a metaInfo.title, this title will be used
|
// if no subcomponents specify a metaInfo.title, this title will be used
|
||||||
title: 'Home',
|
title: 'Home',
|
||||||
// all titles will be injected into this template
|
// all titles will be injected into this template
|
||||||
titleTemplate: '%s | Guides de Paris'
|
titleTemplate: '%s | Guides de Paris',
|
||||||
|
meta: [
|
||||||
|
{ charset: 'utf-8' },
|
||||||
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
HeaderMenu,
|
HeaderMenu,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
buildTemplate () {
|
buildTemplate () {
|
||||||
console.log('EdText buildTemplate: tei', this.tei)
|
// console.log('EdText buildTemplate: tei', this.tei)
|
||||||
// to get Vue.compile working we have to use the full build of vuejs
|
// to get Vue.compile working we have to use the full build of vuejs
|
||||||
// https://vuejs.org/v2/guide/installation.html#Explanation-of-Different-Builds
|
// https://vuejs.org/v2/guide/installation.html#Explanation-of-Different-Builds
|
||||||
// in /build/webpack.config.base.js alias -> 'vue': 'vue/dist/vue.js',
|
// in /build/webpack.config.base.js alias -> 'vue': 'vue/dist/vue.js',
|
||||||
@@ -43,7 +43,7 @@ export default {
|
|||||||
},
|
},
|
||||||
parseLinks () {
|
parseLinks () {
|
||||||
let links = this.html.match(/<a[^<]+<\/a>/g)
|
let links = this.html.match(/<a[^<]+<\/a>/g)
|
||||||
console.log('links', links)
|
// console.log('links', links)
|
||||||
if (links) {
|
if (links) {
|
||||||
// let domparser = new DOMParser()
|
// let domparser = new DOMParser()
|
||||||
// let domlink
|
// let domlink
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import { REST } from 'api/rest-axios'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Bibliographie',
|
name: 'Bibliographie',
|
||||||
|
metaInfo: {
|
||||||
|
title: 'Bibliographie'
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|||||||
+50
-5
@@ -3,13 +3,14 @@
|
|||||||
<template v-if="!content" #header>
|
<template v-if="!content" #header>
|
||||||
<span>Loading ...</span>
|
<span>Loading ...</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="meta" #header>
|
<template #header>
|
||||||
<h1>{{ meta.author }}</h1>
|
<h1>{{ title }}</h1>
|
||||||
|
<p v-if="meta">{{ meta.author }}</p>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- default slot -->
|
<!-- default slot -->
|
||||||
<div id="text">
|
<div id="text">
|
||||||
<EdText :tei="textdata.content.tei" />
|
<EdText v-if="textdata" :tei="textdata.content.tei" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template #nav>
|
<template #nav>
|
||||||
@@ -21,12 +22,20 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { REST } from 'api/rest-axios'
|
import { REST } from 'api/rest-axios'
|
||||||
|
import { mapState, mapActions } from 'vuex'
|
||||||
|
|
||||||
import MainContentLayout from '../components/Layouts/MainContentLayout'
|
import MainContentLayout from '../components/Layouts/MainContentLayout'
|
||||||
import EdText from '../components/Content/EdText'
|
import EdText from '../components/Content/EdText'
|
||||||
import EdToc from '../components/Content/EdToc'
|
import EdToc from '../components/Content/EdToc'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Edition',
|
name: 'Edition',
|
||||||
|
metaInfo () {
|
||||||
|
// console.log('metainfo', this.meta)
|
||||||
|
return {
|
||||||
|
title: this.metainfotitle
|
||||||
|
}
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
MainContentLayout,
|
MainContentLayout,
|
||||||
EdText,
|
EdText,
|
||||||
@@ -37,23 +46,37 @@ export default {
|
|||||||
meta: null,
|
meta: null,
|
||||||
editionid: null,
|
editionid: null,
|
||||||
textid: null,
|
textid: null,
|
||||||
textdata: null
|
textdata: null,
|
||||||
|
metainfotitle: undefined,
|
||||||
|
edtitle: undefined,
|
||||||
|
author: undefined,
|
||||||
|
texttitle: undefined
|
||||||
}),
|
}),
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
editionslist: state => state.Corpus.editionslist,
|
||||||
|
editionsbyuuid: state => state.Corpus.editionsbyuuid
|
||||||
|
})
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
textid: function (newid, oldid) {
|
textid: function (newid, oldid) {
|
||||||
console.log('textid watcher', this, oldid, newid)
|
console.log('textid watcher', this, oldid, newid)
|
||||||
this.getTextContent()
|
this.getTextContent()
|
||||||
|
},
|
||||||
|
textdata: function (newtxtdata, oldtxtdata) {
|
||||||
|
console.log('textdata watcher', oldtxtdata, newtxtdata)
|
||||||
|
this.metainfotitle = `${this.title} ${newtxtdata.meta.title}`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
console.log('texts this.$route', this.$route)
|
console.log('texts this.$route', this.$route)
|
||||||
// http://localhost:8984/texts/gdpSauval1724/toc
|
// http://localhost:8984/texts/gdpSauval1724/toc
|
||||||
this.editionid = this.$route.params.id
|
|
||||||
// get the edition's toc
|
// get the edition's toc
|
||||||
REST.get(`/texts/` + this.$route.params.id + `/toc`, {})
|
REST.get(`/texts/` + this.$route.params.id + `/toc`, {})
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('texts/toc REST: data', data)
|
console.log('texts/toc REST: data', data)
|
||||||
this.meta = data.meta
|
this.meta = data.meta
|
||||||
|
this.author = data.meta.author
|
||||||
if (data.content) {
|
if (data.content) {
|
||||||
if (Array.isArray(data.content)) {
|
if (Array.isArray(data.content)) {
|
||||||
this.toc = data.content
|
this.toc = data.content
|
||||||
@@ -73,6 +96,25 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
// console.log('Edition this.$route.params.id', this.$route.params.id)
|
||||||
|
this.editionid = this.$route.params.id
|
||||||
|
|
||||||
|
// load editions list from Corpus Store if not exist
|
||||||
|
if (!this.editionslist.length) {
|
||||||
|
this.getCorpuses()
|
||||||
|
// subsribe to store to get the editionbyuuid list
|
||||||
|
this.unsubscribe = this.$store.subscribe((mutation, state) => {
|
||||||
|
// console.log('Edition store subscribe', mutation.type)
|
||||||
|
if (mutation.type === 'Corpus/setEditionsByUUID') {
|
||||||
|
console.log('Edition state.Coprus.editionsbyuuid', this.editionid, state.Corpus.editionsbyuuid)
|
||||||
|
// this.title = 'HoHoHo'
|
||||||
|
this.title = this.metainfotitle = state.Corpus.editionsbyuuid[this.editionid].title
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.title = this.metainfotitle = this.editionsbyuuid[this.editionid].title
|
||||||
|
}
|
||||||
|
|
||||||
// get the text if textid available
|
// get the text if textid available
|
||||||
if (this.$route.params.textid) {
|
if (this.$route.params.textid) {
|
||||||
this.textid = this.$route.params.textid
|
this.textid = this.$route.params.textid
|
||||||
@@ -92,6 +134,9 @@ export default {
|
|||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
getCorpuses: 'Corpus/getCorpuses'
|
||||||
|
}),
|
||||||
getTextContent () {
|
getTextContent () {
|
||||||
console.log('getTextContent', this.textid)
|
console.log('getTextContent', this.textid)
|
||||||
if (this.textid) {
|
if (this.textid) {
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ import LocorumItem from '../components/Content/LocorumItem'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'IndexLocorum',
|
name: 'IndexLocorum',
|
||||||
|
metaInfo: {
|
||||||
|
title: 'Index Locorum'
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
LocorumItem,
|
LocorumItem,
|
||||||
MainContentLayout
|
MainContentLayout
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ import NominumItem from '../components/Content/NominumItem'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'IndexNominum',
|
name: 'IndexNominum',
|
||||||
|
metaInfo: {
|
||||||
|
title: 'Index Nominum'
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
NominumItem,
|
NominumItem,
|
||||||
MainContentLayout
|
MainContentLayout
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ import OperumItem from '../components/Content/OperumItem'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'IndexOperum',
|
name: 'IndexOperum',
|
||||||
|
metaInfo: {
|
||||||
|
title: 'Index Operum'
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
OperumItem,
|
OperumItem,
|
||||||
MainContentLayout
|
MainContentLayout
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ import { mapState, mapActions } from 'vuex'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ListCorpus',
|
name: 'ListCorpus',
|
||||||
|
metaInfo: {
|
||||||
|
title: 'Corpus'
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
// CorpusItem,
|
// CorpusItem,
|
||||||
MainContentLayout
|
MainContentLayout
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ export default {
|
|||||||
data: () => ({
|
data: () => ({
|
||||||
content: null
|
content: null
|
||||||
}),
|
}),
|
||||||
|
metaInfo () {
|
||||||
|
return {
|
||||||
|
title: `Locorum ${this.$route.params.id}`
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ export default {
|
|||||||
data: () => ({
|
data: () => ({
|
||||||
content: null
|
content: null
|
||||||
}),
|
}),
|
||||||
|
metaInfo () {
|
||||||
|
return {
|
||||||
|
title: `Nominum ${this.$route.params.id}`
|
||||||
|
}
|
||||||
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
console.log('nominum this.$route', this.$route)
|
console.log('nominum this.$route', this.$route)
|
||||||
REST.get(`/indexNominum/` + this.$route.params.id, {})
|
REST.get(`/indexNominum/` + this.$route.params.id, {})
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ export default {
|
|||||||
data: () => ({
|
data: () => ({
|
||||||
content: null
|
content: null
|
||||||
}),
|
}),
|
||||||
|
metaInfo () {
|
||||||
|
return {
|
||||||
|
title: `Operum ${this.$route.params.id}`
|
||||||
|
}
|
||||||
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
console.log('operum this.$route', this.$route)
|
console.log('operum this.$route', this.$route)
|
||||||
REST.get(`/indexOperum/` + this.$route.params.id, {})
|
REST.get(`/indexOperum/` + this.$route.params.id, {})
|
||||||
|
|||||||
+7
-7
@@ -2,7 +2,7 @@ import Vue from 'vue'
|
|||||||
import Router from 'vue-router'
|
import Router from 'vue-router'
|
||||||
|
|
||||||
import Home from 'pages/Home'
|
import Home from 'pages/Home'
|
||||||
import Item from 'pages/Item'
|
// import Item from 'pages/Item'
|
||||||
import ListCorpus from 'pages/ListCorpus'
|
import ListCorpus from 'pages/ListCorpus'
|
||||||
// import Corpus from 'pages/Corpus'
|
// import Corpus from 'pages/Corpus'
|
||||||
import Edition from 'pages/Edition'
|
import Edition from 'pages/Edition'
|
||||||
@@ -22,12 +22,12 @@ const routes = [
|
|||||||
path: '/',
|
path: '/',
|
||||||
component: Home
|
component: Home
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: 'item',
|
// name: 'item',
|
||||||
path: '/babar/:uuid',
|
// path: '/babar/:uuid',
|
||||||
component: Item,
|
// component: Item,
|
||||||
props: true
|
// props: true
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: 'listcorpus',
|
name: 'listcorpus',
|
||||||
path: '/corpus',
|
path: '/corpus',
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ export default {
|
|||||||
state: {
|
state: {
|
||||||
// items: [],
|
// items: [],
|
||||||
authors: [],
|
authors: [],
|
||||||
editionslist: []
|
editionslist: [],
|
||||||
|
editionsbyuuid: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
@@ -20,6 +21,14 @@ export default {
|
|||||||
},
|
},
|
||||||
setEditionslist (state, editionslist) {
|
setEditionslist (state, editionslist) {
|
||||||
state.editionslist = editionslist
|
state.editionslist = editionslist
|
||||||
|
},
|
||||||
|
setEditionsByUUID (state, editionlist) {
|
||||||
|
for (var i = 0; i < editionlist.length; i++) {
|
||||||
|
for (var j = 0; j < editionlist[i].editions.content.length; j++) {
|
||||||
|
state.editionsbyuuid[editionlist[i].editions.content[j].uuid] = editionlist[i].editions.content[j]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('corpus editionsbyuuid', state.editionsbyuuid)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -41,6 +50,7 @@ export default {
|
|||||||
.then((editionslist) => {
|
.then((editionslist) => {
|
||||||
console.log('all texts returned: editionslist', editionslist)
|
console.log('all texts returned: editionslist', editionslist)
|
||||||
commit('setEditionslist', editionslist)
|
commit('setEditionslist', editionslist)
|
||||||
|
commit('setEditionsByUUID', editionslist)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user