From 7530bb5d4229d7e369231e82ece63622b71b1ebb Mon Sep 17 00:00:00 2001 From: Sandro Ducceschi Date: Tue, 3 Oct 2023 14:15:11 +0200 Subject: [PATCH] MODIFIED: changed resulting url path for podcast details page --- src/components/blocks/PodcastList.vue | 8 ++++---- src/router/index.js | 4 ++-- src/views/PodcastDetail.vue | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/blocks/PodcastList.vue b/src/components/blocks/PodcastList.vue index a901d6b..7695e26 100644 --- a/src/components/blocks/PodcastList.vue +++ b/src/components/blocks/PodcastList.vue @@ -147,16 +147,16 @@ export default { const siteLocale = this.$i18n.locale; const locale = Intl.getCanonicalLocales(siteLocale); - const { data } = await this.$d.api.get(`/podcasts?fields[]=url&fields[]=image&fields[]=release_date&fields[]=content.title,content.description,content.episode&fields[]=status&filter[status][_eq]=published&filter[content][languages_code][_eq]=${locale}&limit=-1`); + const { data } = await this.$d.api.get(`/podcasts?fields[]=url&fields[]=image&fields[]=release_date&fields[]=content.title,content.description,content.slug&fields[]=status&filter[status][_eq]=published&filter[content][languages_code][_eq]=${locale}&limit=-1`); const podcasts = (data || []).map((o) => { - const episode = (o.content[0] || {}).episode ?? null; - const hasEpisode = episode !== null; + const slug = (o.content[0] || {}).slug ?? null; + const hasDetails = slug !== null; const siteUrl = `/${siteLocale}/lp/podcast`; return { image: `${API_URL}/assets/${o.image}`, release_date: o.release_date, url: o.url, - detail_url: hasEpisode ? `${siteUrl}/episode/${episode}` : siteUrl, + detail_url: hasDetails ? `${siteUrl}/${slug}` : siteUrl, title: (o.content[0] || {}).title, description: (o.content[0] || {}).description, readmore: false, diff --git a/src/router/index.js b/src/router/index.js index 1f635ae..3a1262d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -67,9 +67,9 @@ export function getRouter() { })); routes = routes.concat([{ name: 'podcast-detail', - path: '/:lang/lp/podcast/episode/:slug', + path: '/:lang/lp/podcast/:slug', component: PodcastDetail, - props: route => ({ episode: route.params.slug }), + props: route => ({ slug: route.params.slug }), }]); Vue.use(Router); const router = new Router({ diff --git a/src/views/PodcastDetail.vue b/src/views/PodcastDetail.vue index b029704..ce31007 100644 --- a/src/views/PodcastDetail.vue +++ b/src/views/PodcastDetail.vue @@ -44,7 +44,7 @@ export default { // //--------------------------------------------------- props: { - episode: { + slug: { type: String, default: null, }, @@ -122,7 +122,7 @@ export default { metaTitle() { const content = this.details?.content[0] || {}; const lead = this.leadSection; - let title = content.title || `Podcast Episode #${this.episode}`; + let title = content.title || ''; title = lead.title || title; return title; }, @@ -174,7 +174,7 @@ export default { // render(h) { return h(); }, async mounted() { const locale = Intl.getCanonicalLocales(this.$i18n.locale); - const { data } = await this.$d.api.get(`/podcasts?fields[]=image&fields[]=content.title,content.description,content.page_blocks&filter[status][_eq]=published&filter[content][languages_code][_eq]=${locale}&filter[content][episode][_eq]=${this.episode}&limit=1`); + const { data } = await this.$d.api.get(`/podcasts?fields[]=image&fields[]=content.title,content.description,content.page_blocks&filter[status][_eq]=published&filter[content][languages_code][_eq]=${locale}&filter[content][slug][_eq]=${this.slug}&limit=1`); this.details = (Array.isArray(data) && data[0] !== null) ? data[0] : null; /* if (!this.$d.data) {