mirror of
https://github.com/ArthurDanjou/website-old.git
synced 2026-01-24 08:50:33 +01:00
fix blog translations
This commit is contained in:
@@ -120,8 +120,10 @@ export default {
|
|||||||
this.scrollPosition = window.scrollY
|
this.scrollPosition = window.scrollY
|
||||||
},
|
},
|
||||||
async changeLanguage(lang) {
|
async changeLanguage(lang) {
|
||||||
await this.$router.push('/')
|
await this.$i18n.setLocale(lang)
|
||||||
this.$i18n.setLocale(lang)
|
if (this.$router.currentRoute.fullPath.includes('blog')) {
|
||||||
|
await this.$nuxt.refresh()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async asyncData({ params, $content, app, $axios, error }) {
|
async asyncData({ params, $content, app, $axios, error }) {
|
||||||
const post = await $content(`articles/${app.i18n.locale}/`, params.slug)
|
const post = await $content(`${app.i18n.locale}`, params.slug)
|
||||||
.fetch()
|
.fetch()
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
error({ statusCode: 404, message: "Post not found" });
|
error({ statusCode: 404, message: "Post not found" });
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async resetPosts() {
|
async resetPosts() {
|
||||||
this.current_tag = ''
|
this.current_tag = ''
|
||||||
this.posts = await this.$content(`articles/${this.$i18n.locale}`)
|
this.posts = await this.$content(`${this.$i18n.locale}`)
|
||||||
.sortBy('date', 'asc')
|
.sortBy('date', 'asc')
|
||||||
.limit(5)
|
.limit(5)
|
||||||
.fetch()
|
.fetch()
|
||||||
@@ -159,13 +159,13 @@ export default {
|
|||||||
async fetchPosts() {
|
async fetchPosts() {
|
||||||
let postsTemp = []
|
let postsTemp = []
|
||||||
if (this.current_tag === "") {
|
if (this.current_tag === "") {
|
||||||
postsTemp = await this.$content(`articles/${this.$i18n.locale}`)
|
postsTemp = await this.$content(`${this.$i18n.locale}`)
|
||||||
.sortBy('date', 'asc')
|
.sortBy('date', 'asc')
|
||||||
.limit(5)
|
.limit(5)
|
||||||
.skip(this.page * 5)
|
.skip(this.page * 5)
|
||||||
.fetch()
|
.fetch()
|
||||||
} else {
|
} else {
|
||||||
postsTemp = await this.$content(`articles/${this.$i18n.locale}`)
|
postsTemp = await this.$content(`${this.$i18n.locale}`)
|
||||||
.sortBy('date', 'asc')
|
.sortBy('date', 'asc')
|
||||||
.limit(5)
|
.limit(5)
|
||||||
.skip(this.page * 5)
|
.skip(this.page * 5)
|
||||||
@@ -184,13 +184,13 @@ export default {
|
|||||||
this.posts = posts
|
this.posts = posts
|
||||||
},
|
},
|
||||||
async fetchPrevAndNext() {
|
async fetchPrevAndNext() {
|
||||||
const [_, next] = await this.$content(`articles/${this.$i18n.locale}`)
|
const [_, next] = await this.$content(`${this.$i18n.locale}`)
|
||||||
.surround(this.posts[this.posts.length - 1].slug, {
|
.surround(this.posts[this.posts.length - 1].slug, {
|
||||||
before: 1,
|
before: 1,
|
||||||
after: 1
|
after: 1
|
||||||
})
|
})
|
||||||
.fetch()
|
.fetch()
|
||||||
const [prev, __] = await this.$content(`articles/${this.$i18n.locale}`)
|
const [prev, __] = await this.$content(`${this.$i18n.locale}`)
|
||||||
.skip(this.page)
|
.skip(this.page)
|
||||||
.surround(this.posts[0].slug, {
|
.surround(this.posts[0].slug, {
|
||||||
before: 1,
|
before: 1,
|
||||||
@@ -210,7 +210,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async asyncData ({ $content, app }) {
|
async asyncData ({ $content, app }) {
|
||||||
const tags = await $content('tags').fetch()
|
const tags = await $content('tags').fetch()
|
||||||
const postsTemp = await $content(`articles/${app.i18n.locale}`)
|
const postsTemp = await $content(`${app.i18n.locale}`)
|
||||||
.sortBy('date', 'asc')
|
.sortBy('date', 'asc')
|
||||||
.limit(5)
|
.limit(5)
|
||||||
.fetch()
|
.fetch()
|
||||||
@@ -224,14 +224,14 @@ export default {
|
|||||||
let next = null
|
let next = null
|
||||||
|
|
||||||
if (posts.length > 0) {
|
if (posts.length > 0) {
|
||||||
const [_, nextTemp] = await $content(`articles/${app.i18n.locale}`)
|
const [_, nextTemp] = await $content(`${app.i18n.locale}`)
|
||||||
.surround(posts[posts.length - 1].slug, {
|
.surround(posts[posts.length - 1].slug, {
|
||||||
before: 1,
|
before: 1,
|
||||||
after: 1
|
after: 1
|
||||||
})
|
})
|
||||||
.fetch()
|
.fetch()
|
||||||
|
|
||||||
const [prevTemp, __] = await $content(`articles/${app.i18n.locale}`)
|
const [prevTemp, __] = await $content(`${app.i18n.locale}`)
|
||||||
.surround(posts[0].slug, {
|
.surround(posts[0].slug, {
|
||||||
before: 1,
|
before: 1,
|
||||||
after: 1
|
after: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user