Skip to content

Commit

Permalink
MODIFIED: changed resulting url path for podcast details page
Browse files Browse the repository at this point in the history
  • Loading branch information
sd-ditoy committed Oct 3, 2023
1 parent 49c515a commit 7530bb5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/components/blocks/PodcastList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions src/views/PodcastDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default {
//
//---------------------------------------------------
props: {
episode: {
slug: {
type: String,
default: null,
},
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7530bb5

Please sign in to comment.