Skip to content

Commit

Permalink
dedupe in the homepage topper (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
walsh9 authored Oct 18, 2022
1 parent cb709da commit 54e8b08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion components/GothamistHomepageTopper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ const props = defineProps<{
}>()
const featuredArticle = computed(() => props.articles[0])
const latestArticles = computed(() => props.articles.slice(1))
const latestArticles = computed(() => {
return props.articles.slice(1)
// remove the manually curated featured article
// from the list of latest articles so it
// doesn't show up twice in this module
.filter(article => article.uuid !== featuredArticle.value.uuid)
.slice(0,4)
})
</script>

<template v-if="featuredArticle && latestArticles">
Expand Down
4 changes: 2 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const [articles, homePageCollections] = await Promise.all([
homePageCollectionsPromise,
])
// the latest 4 articles
const latestArticles = articles.slice(0, 4)
// the latest articles
const latestArticles = articles
// the home page featured article should display only the first story in the home page content collection
const featuredArticle = normalizeArticlePage(homePageCollections?.[0].data?.[0])
Expand Down

0 comments on commit 54e8b08

Please sign in to comment.