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
|
||||
title: 'Home',
|
||||
// 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: {
|
||||
HeaderMenu,
|
||||
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
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
|
||||
// https://vuejs.org/v2/guide/installation.html#Explanation-of-Different-Builds
|
||||
// in /build/webpack.config.base.js alias -> 'vue': 'vue/dist/vue.js',
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
parseLinks () {
|
||||
let links = this.html.match(/<a[^<]+<\/a>/g)
|
||||
console.log('links', links)
|
||||
// console.log('links', links)
|
||||
if (links) {
|
||||
// let domparser = new DOMParser()
|
||||
// let domlink
|
||||
|
||||
@@ -13,6 +13,9 @@ import { REST } from 'api/rest-axios'
|
||||
|
||||
export default {
|
||||
name: 'Bibliographie',
|
||||
metaInfo: {
|
||||
title: 'Bibliographie'
|
||||
},
|
||||
data: () => ({
|
||||
|
||||
}),
|
||||
|
||||
+50
-5
@@ -3,13 +3,14 @@
|
||||
<template v-if="!content" #header>
|
||||
<span>Loading ...</span>
|
||||
</template>
|
||||
<template v-if="meta" #header>
|
||||
<h1>{{ meta.author }}</h1>
|
||||
<template #header>
|
||||
<h1>{{ title }}</h1>
|
||||
<p v-if="meta">{{ meta.author }}</p>
|
||||
</template>
|
||||
|
||||
<!-- default slot -->
|
||||
<div id="text">
|
||||
<EdText :tei="textdata.content.tei" />
|
||||
<EdText v-if="textdata" :tei="textdata.content.tei" />
|
||||
</div>
|
||||
|
||||
<template #nav>
|
||||
@@ -21,12 +22,20 @@
|
||||
<script>
|
||||
|
||||
import { REST } from 'api/rest-axios'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
|
||||
import MainContentLayout from '../components/Layouts/MainContentLayout'
|
||||
import EdText from '../components/Content/EdText'
|
||||
import EdToc from '../components/Content/EdToc'
|
||||
|
||||
export default {
|
||||
name: 'Edition',
|
||||
metaInfo () {
|
||||
// console.log('metainfo', this.meta)
|
||||
return {
|
||||
title: this.metainfotitle
|
||||
}
|
||||
},
|
||||
components: {
|
||||
MainContentLayout,
|
||||
EdText,
|
||||
@@ -37,23 +46,37 @@ export default {
|
||||
meta: null,
|
||||
editionid: 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: {
|
||||
textid: function (newid, oldid) {
|
||||
console.log('textid watcher', this, oldid, newid)
|
||||
this.getTextContent()
|
||||
},
|
||||
textdata: function (newtxtdata, oldtxtdata) {
|
||||
console.log('textdata watcher', oldtxtdata, newtxtdata)
|
||||
this.metainfotitle = `${this.title} ${newtxtdata.meta.title}`
|
||||
}
|
||||
},
|
||||
beforeCreate () {
|
||||
console.log('texts this.$route', this.$route)
|
||||
// http://localhost:8984/texts/gdpSauval1724/toc
|
||||
this.editionid = this.$route.params.id
|
||||
// get the edition's toc
|
||||
REST.get(`/texts/` + this.$route.params.id + `/toc`, {})
|
||||
.then(({ data }) => {
|
||||
console.log('texts/toc REST: data', data)
|
||||
this.meta = data.meta
|
||||
this.author = data.meta.author
|
||||
if (data.content) {
|
||||
if (Array.isArray(data.content)) {
|
||||
this.toc = data.content
|
||||
@@ -73,6 +96,25 @@ export default {
|
||||
})
|
||||
},
|
||||
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
|
||||
if (this.$route.params.textid) {
|
||||
this.textid = this.$route.params.textid
|
||||
@@ -92,6 +134,9 @@ export default {
|
||||
next()
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
getCorpuses: 'Corpus/getCorpuses'
|
||||
}),
|
||||
getTextContent () {
|
||||
console.log('getTextContent', this.textid)
|
||||
if (this.textid) {
|
||||
|
||||
@@ -23,6 +23,9 @@ import LocorumItem from '../components/Content/LocorumItem'
|
||||
|
||||
export default {
|
||||
name: 'IndexLocorum',
|
||||
metaInfo: {
|
||||
title: 'Index Locorum'
|
||||
},
|
||||
components: {
|
||||
LocorumItem,
|
||||
MainContentLayout
|
||||
|
||||
@@ -23,6 +23,9 @@ import NominumItem from '../components/Content/NominumItem'
|
||||
|
||||
export default {
|
||||
name: 'IndexNominum',
|
||||
metaInfo: {
|
||||
title: 'Index Nominum'
|
||||
},
|
||||
components: {
|
||||
NominumItem,
|
||||
MainContentLayout
|
||||
|
||||
@@ -23,6 +23,9 @@ import OperumItem from '../components/Content/OperumItem'
|
||||
|
||||
export default {
|
||||
name: 'IndexOperum',
|
||||
metaInfo: {
|
||||
title: 'Index Operum'
|
||||
},
|
||||
components: {
|
||||
OperumItem,
|
||||
MainContentLayout
|
||||
|
||||
@@ -52,6 +52,9 @@ import { mapState, mapActions } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'ListCorpus',
|
||||
metaInfo: {
|
||||
title: 'Corpus'
|
||||
},
|
||||
components: {
|
||||
// CorpusItem,
|
||||
MainContentLayout
|
||||
|
||||
@@ -32,6 +32,11 @@ export default {
|
||||
data: () => ({
|
||||
content: null
|
||||
}),
|
||||
metaInfo () {
|
||||
return {
|
||||
title: `Locorum ${this.$route.params.id}`
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
beforeCreate () {
|
||||
|
||||
@@ -33,6 +33,11 @@ export default {
|
||||
data: () => ({
|
||||
content: null
|
||||
}),
|
||||
metaInfo () {
|
||||
return {
|
||||
title: `Nominum ${this.$route.params.id}`
|
||||
}
|
||||
},
|
||||
beforeCreate () {
|
||||
console.log('nominum this.$route', this.$route)
|
||||
REST.get(`/indexNominum/` + this.$route.params.id, {})
|
||||
|
||||
@@ -29,6 +29,11 @@ export default {
|
||||
data: () => ({
|
||||
content: null
|
||||
}),
|
||||
metaInfo () {
|
||||
return {
|
||||
title: `Operum ${this.$route.params.id}`
|
||||
}
|
||||
},
|
||||
beforeCreate () {
|
||||
console.log('operum this.$route', this.$route)
|
||||
REST.get(`/indexOperum/` + this.$route.params.id, {})
|
||||
|
||||
+7
-7
@@ -2,7 +2,7 @@ import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
|
||||
import Home from 'pages/Home'
|
||||
import Item from 'pages/Item'
|
||||
// import Item from 'pages/Item'
|
||||
import ListCorpus from 'pages/ListCorpus'
|
||||
// import Corpus from 'pages/Corpus'
|
||||
import Edition from 'pages/Edition'
|
||||
@@ -22,12 +22,12 @@ const routes = [
|
||||
path: '/',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
name: 'item',
|
||||
path: '/babar/:uuid',
|
||||
component: Item,
|
||||
props: true
|
||||
},
|
||||
// {
|
||||
// name: 'item',
|
||||
// path: '/babar/:uuid',
|
||||
// component: Item,
|
||||
// props: true
|
||||
// },
|
||||
{
|
||||
name: 'listcorpus',
|
||||
path: '/corpus',
|
||||
|
||||
@@ -7,7 +7,8 @@ export default {
|
||||
state: {
|
||||
// items: [],
|
||||
authors: [],
|
||||
editionslist: []
|
||||
editionslist: [],
|
||||
editionsbyuuid: {}
|
||||
},
|
||||
|
||||
// getters
|
||||
@@ -20,6 +21,14 @@ export default {
|
||||
},
|
||||
setEditionslist (state, 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) => {
|
||||
console.log('all texts returned: editionslist', editionslist)
|
||||
commit('setEditionslist', editionslist)
|
||||
commit('setEditionsByUUID', editionslist)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user