updating language switcher links on route change; fixed prev/next blabla article links
This commit is contained in:
parent
2b67b22ce5
commit
584c4cc5d2
File diff suppressed because one or more lines are too long
|
@ -103,7 +103,6 @@ Vue.use(VueSimpleAccordion, {
|
||||||
function initVi18n () {
|
function initVi18n () {
|
||||||
// i18n.locale = drupalDecoupled.lang_code
|
// i18n.locale = drupalDecoupled.lang_code
|
||||||
// console.log('i18n.messages', i18n.messages)
|
// console.log('i18n.messages', i18n.messages)
|
||||||
|
|
||||||
loadLanguageAsync(drupalDecoupled.lang_code)
|
loadLanguageAsync(drupalDecoupled.lang_code)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('main.js language loaded')
|
console.log('main.js language loaded')
|
||||||
|
@ -164,6 +163,22 @@ Vue.use(VueSimpleAccordion, {
|
||||||
}
|
}
|
||||||
document.querySelector('body').classList.add(...classes)
|
document.querySelector('body').classList.add(...classes)
|
||||||
|
|
||||||
|
// update block language selection
|
||||||
|
let links = document.querySelectorAll('#block-languageswitcher a.language-link')
|
||||||
|
let path = to.path.replace(/^\/\D{2,3}\//, '')
|
||||||
|
// remove language relative prefix from path classes (fr, en, etc)
|
||||||
|
.replace(/^\/\D{2,3}$/, '')
|
||||||
|
|
||||||
|
if(path !== ''){
|
||||||
|
path = '/'+path
|
||||||
|
}
|
||||||
|
|
||||||
|
links.forEach((link, i) => {
|
||||||
|
console.log("language link",path , link)
|
||||||
|
link.setAttribute('href', `/${link.getAttribute('hreflang')}${path}`)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// trigger router
|
// trigger router
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
|
@ -295,8 +295,10 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
onPrevNext(a){
|
onPrevNext(a){
|
||||||
// console.log('clicked on next', this.prevnext.next);
|
console.log('clicked on prev/next; a', a);
|
||||||
let alias = a.replace(/^.?\/blabla\//g, '')
|
let alias = a.replace(/^\/\D{2,3}\/blabla\//g, '')
|
||||||
|
console.log('alias', alias);
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name:`article`,
|
name:`article`,
|
||||||
params: { alias:alias }
|
params: { alias:alias }
|
||||||
|
|
Loading…
Reference in New Issue