Skip to content

Commit

Permalink
fix: descriptions in blogs
Browse files Browse the repository at this point in the history
  • Loading branch information
GonzaloHirsch committed Apr 6, 2024
1 parent 0c3969d commit 5967883
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion components/blog/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
>
{{ $formatDate(article.date) }}
</p>
<p>{{ article.excerpt }}</p>
<p>{{ article.description }}</p>
<!-- <ul class="article-tags">
<li class="tag !py-0.5" v-for="(tag, n) in article.tags" :key="n">{{ tag }}</li>
</ul> -->
Expand Down
46 changes: 25 additions & 21 deletions components/blog/relatedArticles.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
<template>
<div>
<span class="blog-aside-title mb-2 block">Continue Reading</span>
<ul class="list-none">
<template v-for="(other, index) in surround" :key="index">
<li v-if="other" class="first:mt-0 mt-4 md:mt-1">
<NuxtLink
:to="other._path + '/'"
class="hover:underline hover:text-brand_primary_light dark:hover:text-brand_primary_dark"
:aria-label="other.headline"
>
{{ other.headline }}
</NuxtLink>
<p class="!no-underline md:hidden text-sm leading-sm md:text-xs md:leading-xs mt-1">{{ other.excerpt }}</p>
</li>
</template>
</ul>
</div>
<div>
<span class="blog-aside-title mb-2 block">Continue Reading</span>
<ul class="list-none">
<template v-for="(other, index) in surround" :key="index">
<li v-if="other" class="first:mt-0 mt-4 md:mt-1">
<NuxtLink
:to="other._path + '/'"
class="hover:underline hover:text-brand_primary_light dark:hover:text-brand_primary_dark"
:aria-label="other.headline"
>
{{ other.headline }}
</NuxtLink>
<p
class="!no-underline md:hidden text-sm leading-sm md:text-xs md:leading-xs mt-1"
>
{{ other.description }}
</p>
</li>
</template>
</ul>
</div>
</template>

<script setup>
defineProps({
surround: {
type: Array,
required: true
}
surround: {
type: Array,
required: true,
},
});
</script>
4 changes: 2 additions & 2 deletions components/sitemap/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<h3
:class="[
'text-h4 leading-h4 font-semibold group-hover:text-brand_primary_light dark:group-hover:text-brand_primary_dark',
link.excerpt ? 'mb-2' : 'mb-0',
link.description ? 'mb-2' : 'mb-0',
]"
>
{{ link.headline }}
</h3>
<p v-if="link.excerpt">{{ link.excerpt }}</p>
<p v-if="link.description">{{ link.description }}</p>
</header>
</div>
</NuxtLink>
Expand Down
2 changes: 1 addition & 1 deletion ideas/search/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const { data } = await useAsyncData(
],
})
.sort({ date: -1 })
.only(['headline', 'excerpt', 'date', 'tags', '_path'])
.only(['headline', 'description', 'date', 'tags', '_path'])
.find();
},
{
Expand Down
8 changes: 4 additions & 4 deletions pages/blog/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<p
class="blog-post-text mb-8 md:w-8/12 md:text-lg md:leading-lg text-center md:text-left"
>
{{ doc.excerpt }}
{{ doc.description }}
</p>
<div
class="border-b-2 pb-8 border-typography_primary_light dark:border-typography_primary_dark flex flex-col md:flex-row items-center md:justify-between mt-12 md:mt-4"
Expand All @@ -86,7 +86,7 @@
<div class="mt-6 md:mt-0">
<NavShareIcons
:headline="doc.headline"
:excerpt="doc.excerpt"
:excerpt="doc.description"
:path="doc._path + '/'"
/>
</div>
Expand Down Expand Up @@ -177,7 +177,7 @@ const { data, error } = await useAsyncData(`content-${cleanPath}`, async () => {
// which is an array of documeents that come before and after the current document
let surround = queryContent('/blog')
.sort({ date: -1 })
.only(['_path', 'headline', 'excerpt'])
.only(['_path', 'headline', 'description'])
.findSurround(cleanPath, { before: 1, after: 1 });
return {
article: await article,
Expand Down Expand Up @@ -210,7 +210,7 @@ const jsonScripts = [
url: canonicalPath,
image: image,
headline: data.value?.article?.headline,
abstract: data.value?.article?.excerpt,
abstract: data.value?.article?.description,
datePublished: data.value?.article?.date,
dateModified:
data.value?.article?.dateUpdated || data.value?.article?.date,
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Section id="main" class="!pt-0">
<ContentQuery
path="/blog"
:only="['headline', 'excerpt', 'date', 'tags', '_path', 'image']"
:only="['headline', 'description', 'date', 'tags', '_path', 'image']"
:sort="{
date: -1,
}"
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/page/[number].vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<main>
<ContentQuery
path="/blog"
:only="['headline', 'excerpt', 'date', 'tags', '_path', 'image']"
:only="['headline', 'description', 'date', 'tags', '_path', 'image']"
:sort="{
date: -1,
}"
Expand Down
2 changes: 1 addition & 1 deletion pages/sitemap/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</h2>
<ContentQuery
path="/blog"
:only="['headline', 'excerpt', '_path', 'image']"
:only="['headline', 'description', '_path', 'image']"
:sort="{
headline: 1,
}"
Expand Down

0 comments on commit 5967883

Please sign in to comment.