✨ Post tag & category filtered page
This commit is contained in:
parent
2b9601640b
commit
58ad9996cd
@ -27,7 +27,10 @@
|
|||||||
</article>
|
</article>
|
||||||
|
|
||||||
<v-card v-if="post.body?.attachments?.length > 0" class="mb-5">
|
<v-card v-if="post.body?.attachments?.length > 0" class="mb-5">
|
||||||
<attachment-carousel :no-clickable-attachment="props.noClickableAttachment" :attachments="post.body?.attachments" />
|
<attachment-carousel
|
||||||
|
:no-clickable-attachment="props.noClickableAttachment"
|
||||||
|
:attachments="post.body?.attachments"
|
||||||
|
/>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
|
||||||
<div class="text-sm flex flex-col">
|
<div class="text-sm flex flex-col">
|
||||||
@ -45,8 +48,18 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="post.tags?.length > 0" class="text-xs text-grey flex flex-row gap-1 mt-3">
|
<div
|
||||||
<span v-for="tag in post.tags">#{{ tag.alias }}</span>
|
v-if="post.tags?.length > 0"
|
||||||
|
class="text-xs text-grey flex flex-row gap-1 mt-3"
|
||||||
|
>
|
||||||
|
<nuxt-link
|
||||||
|
v-for="tag in post.tags"
|
||||||
|
:to="`/posts/tags/${tag.alias}`"
|
||||||
|
class="hover:underline hover:underline-dotted"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
#{{ tag.alias }}
|
||||||
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{ author?: string, realmId?: number }>()
|
const props = defineProps<{ author?: string, tag?: string, category?: string, realmId?: number }>()
|
||||||
|
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
|
|
||||||
@ -26,6 +26,13 @@ async function loadPost({ done }: any) {
|
|||||||
searchQueries.set("realmId", props.realmId.toString())
|
searchQueries.set("realmId", props.realmId.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.tag) {
|
||||||
|
searchQueries.set("tag", props.tag)
|
||||||
|
}
|
||||||
|
if (props.category) {
|
||||||
|
searchQueries.set("category", props.category)
|
||||||
|
}
|
||||||
|
|
||||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?` + searchQueries)
|
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?` + searchQueries)
|
||||||
const result = await res.json()
|
const result = await res.json()
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
"navGalleryCaption": "Explore files that uploaded by Solar Network users.",
|
"navGalleryCaption": "Explore files that uploaded by Solar Network users.",
|
||||||
"navPosts": "Posts",
|
"navPosts": "Posts",
|
||||||
"navPostsCaption": "Explore posts that posted by Solar Network users.",
|
"navPostsCaption": "Explore posts that posted by Solar Network users.",
|
||||||
|
"navPostsCaptionWithTag": "Explore posts with tag {0}.",
|
||||||
|
"navPostsCaptionWithCategory": "Explore posts in category {0}.",
|
||||||
"indexIntroduce": "An energetic software company that create wonderful software which everyone love.",
|
"indexIntroduce": "An energetic software company that create wonderful software which everyone love.",
|
||||||
"indexProductListHint": "See some of our products just there",
|
"indexProductListHint": "See some of our products just there",
|
||||||
"indexActivities": "Activities",
|
"indexActivities": "Activities",
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
"navGalleryCaption": "探索整个 Solar Network 上的文件。",
|
"navGalleryCaption": "探索整个 Solar Network 上的文件。",
|
||||||
"navPosts": "帖子",
|
"navPosts": "帖子",
|
||||||
"navPostsCaption": "探索整个 Solar Network 上的帖子。",
|
"navPostsCaption": "探索整个 Solar Network 上的帖子。",
|
||||||
|
"navPostsCaptionWithTag": "探索带有 {0} 标签的帖子",
|
||||||
|
"navPostsCaptionWithCategory": "探索被分类为 {0} 的帖子",
|
||||||
"indexIntroduce": "一家充满活力的软件公司,创造了人人喜爱的精彩软件。",
|
"indexIntroduce": "一家充满活力的软件公司,创造了人人喜爱的精彩软件。",
|
||||||
"indexProductListHint": "在这里看看我们的一些产品",
|
"indexProductListHint": "在这里看看我们的一些产品",
|
||||||
"indexActivities": "动态",
|
"indexActivities": "动态",
|
||||||
|
@ -41,8 +41,18 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="post.tags?.length > 0" class="text-xs text-grey flex flex-row gap-1 mb-3">
|
<div
|
||||||
<span v-for="tag in post.tags">#{{ tag.alias }}</span>
|
v-if="post.tags?.length > 0"
|
||||||
|
class="text-xs text-grey flex flex-row gap-1 mb-3"
|
||||||
|
>
|
||||||
|
<nuxt-link
|
||||||
|
v-for="tag in post.tags"
|
||||||
|
:to="`/posts/tags/${tag.alias}`"
|
||||||
|
class="hover:underline hover:underline-dotted"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
#{{ tag.alias }}
|
||||||
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-xs text-grey flex flex-col mb-5">
|
<div class="text-xs text-grey flex flex-col mb-5">
|
||||||
|
34
pages/posts/categories/[...slug].vue
Normal file
34
pages/posts/categories/[...slug].vue
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<v-container class="content-container mx-auto">
|
||||||
|
<div class="my-3 mx-[3.5ch]">
|
||||||
|
<h1 class="text-2xl">{{ t("navPosts") }}</h1>
|
||||||
|
<span>{{ t("navPostsCaptionWithCategory", [`#${route.params.slug}`]) }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<post-list :category="route.params.slug?.toString()" />
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: t("navActivity"),
|
||||||
|
})
|
||||||
|
|
||||||
|
useSeoMeta({
|
||||||
|
title: t("navActivity"),
|
||||||
|
ogTitle: t("navActivity"),
|
||||||
|
description: t("navActivityCaption"),
|
||||||
|
ogDescription: t("navActivityCaption"),
|
||||||
|
ogType: "website",
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.content-container {
|
||||||
|
max-width: 70ch !important;
|
||||||
|
}
|
||||||
|
</style>
|
34
pages/posts/tags/[...slug].vue
Normal file
34
pages/posts/tags/[...slug].vue
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<v-container class="content-container mx-auto">
|
||||||
|
<div class="my-3 mx-[3.5ch]">
|
||||||
|
<h1 class="text-2xl">{{ t("navPosts") }}</h1>
|
||||||
|
<span>{{ t("navPostsCaptionWithTag", [`#${route.params.slug}`]) }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<post-list :tag="route.params.slug?.toString()" />
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: t("navActivity"),
|
||||||
|
})
|
||||||
|
|
||||||
|
useSeoMeta({
|
||||||
|
title: t("navActivity"),
|
||||||
|
ogTitle: t("navActivity"),
|
||||||
|
description: t("navActivityCaption"),
|
||||||
|
ogDescription: t("navActivityCaption"),
|
||||||
|
ogType: "website",
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.content-container {
|
||||||
|
max-width: 70ch !important;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue
Block a user