@@ -64,6 +64,17 @@ const paginatedArticles = computed(() => {
6464 return visibleArticles .value .slice (start, start + pageSize);
6565});
6666
67+ function externalSite (article ) {
68+ if (! article? .external_url ) return " " ;
69+ if (article? .external_site ) return article .external_site ;
70+ try {
71+ const u = new URL (article .external_url );
72+ return u .hostname .replace (/ ^ www\. / , " " );
73+ } catch {
74+ return article .external_url ;
75+ }
76+ }
77+
6778function toggleTag (tag ) {
6879 if (selectedTags .value .includes (tag)) {
6980 selectedTags .value = selectedTags .value .filter ((el ) => el !== tag);
@@ -201,46 +212,51 @@ watch(
201212 < div class = " container mx-auto space-y-8" >
202213 < div class = " space-y-4" >
203214 < div class = " grid gap-4" >
204- <NuxtLink
205- v-for =" article in paginatedArticles"
206- :key =" article._id"
207- :to =" article.path"
208- class =" h-full"
209- >
210- <div
211- class =" flex flex-col justify-between space-y-3 bg-black/50 p-4 text-white drop-shadow-lg hover:ring-1 hover:ring-white"
212- >
213- <div class =" space-y-1" >
214- <div
215- class =" flex flex-col gap-1 md:flex-row md:items-center md:gap-3"
216- >
217- <p
218- class =" text-lg font-semibold text-orange-400 md:flex-1 md:text-xl"
215+ < template v- for = " article in paginatedArticles" : key= " article._id" >
216+ < NuxtLink : to= " article.path" class = " h-full" >
217+ < div
218+ class = " flex flex-col justify-between space-y-3 bg-black/50 p-4 text-white drop-shadow-lg hover:ring-1 hover:ring-white"
219+ >
220+ < div class = " space-y-1" >
221+ < div
222+ class = " flex flex-col gap-1 md:flex-row md:items-center md:gap-3"
219223 >
220- {{ article.title }}
221- </p >
222- <NuxtTime
223- :datetime =" article.date"
224- class =" text-sm text-gray-300 md:text-right"
225- year =" numeric"
226- month =" short"
227- day =" 2-digit"
228- />
224+ < p
225+ class = " text-lg font-semibold text-orange-400 md:flex-1 md:text-xl"
226+ >
227+ {{ article .title }}
228+ < / p>
229+ < div class = " flex items-center gap-2 md:ml-auto" >
230+ < template v- if = " article.external_url" >
231+ < span
232+ class = " rounded border border-orange-500/30 bg-orange-500/20 px-2 py-0.5 text-[10px] uppercase tracking-wide text-orange-300"
233+ > {{ externalSite (article) }}< / span
234+ >
235+ < / template>
236+ < NuxtTime
237+ : datetime= " article.date"
238+ class = " text-sm text-gray-300 md:text-right"
239+ year= " numeric"
240+ month= " short"
241+ day= " 2-digit"
242+ / >
243+ < / div>
244+ < / div>
229245 < / div>
246+ < p
247+ v- if = " article.description"
248+ class = " line-clamp-3 text-sm text-gray-100"
249+ >
250+ {{ article .description }}
251+ < / p>
252+ < ContentRenderer
253+ v- else - if = " article.meta?.excerpt"
254+ : value= " article.meta.excerpt"
255+ class = " line-clamp-4 text-sm text-gray-100"
256+ / >
230257 < / div>
231- <p
232- v-if =" article.description"
233- class =" line-clamp-3 text-sm text-gray-100"
234- >
235- {{ article.description }}
236- </p >
237- <ContentRenderer
238- v-else-if =" article.meta?.excerpt"
239- :value =" article.meta.excerpt"
240- class =" line-clamp-4 text-sm text-gray-100"
241- />
242- </div >
243- </NuxtLink >
258+ < / NuxtLink>
259+ < / template>
244260 < / div>
245261
246262 < div class = " flex items-center justify-between text-sm text-gray-300" >
0 commit comments