Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/blog'
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Nov 13, 2024
2 parents dd14e9e + c98787c commit abc9e86
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/views/Blog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<div class="px-6 py-4" v-if="!loading">
<template v-if="news.length">
<h2 class="text-lg font-bold mb-6">Get the latest news from FTB</h2>
<div class="news-item mb-10" v-for="(newsItem, index) in news" :key="index">
<div class="news-item" v-for="(newsItem, index) in news" :key="index">
<a :href="`${domain}/blog/p/${newsItem.slug}`" @click="openExternal" v-if="newsItem.feature_image" class="feature-image mb-4 block">
<img crossorigin="anonymous" class="rounded shadow-xl" :src="proxyImage(newsItem.feature_image)" alt="Feature image">
<img crossorigin="anonymous" class="rounded shadow-xl" :src="newsItem.feature_image" alt="Feature image">
</a>

<div class="about">
Expand All @@ -13,14 +13,15 @@
</div>

<div class="author-and-info flex items-center gap-4">
<img class="avatar rounded shadow-xl" crossorigin="anonymous" width="50" :src="proxyImage(newsItem.primary_author.profile_image)" alt="Avatar">
<img class="avatar rounded shadow-xl" crossorigin="anonymous" width="50" :src="newsItem.primary_author.profile_image" alt="Avatar">
<div class="info">
<b class="opacity-75">{{ newsItem.primary_author.name }}</b>
<div class="info opacity-75 text-sm" :title="standardDateTime(newsItem.published_at)">
{{ dayjs(newsItem.published_at).fromNow() }}
</div>
</div>
</div>
<hr class="my-8 border-white border-opacity-25"/>
</div>
</template>
<div v-else>
Expand Down Expand Up @@ -73,16 +74,6 @@ export default class Blog extends Vue {
}
}
proxyImage(image: string) {
if (!image) return '';
// Yeet the domain
const imgPath = image.replace("http://", "https://").replace('https://ghost.ftb.team/content/images/', '');
const encodedPath = encodeURIComponent(imgPath);
return `${constants.metaApi}/v1/blog/image/${encodedPath}`
}
get domain() {
return constants.ftbDomain
}
Expand Down

0 comments on commit abc9e86

Please sign in to comment.