update blog index

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2022-12-20 23:38:40 +06:00
parent b2e29d76df
commit ec4ddcf7c9
7 changed files with 36 additions and 11 deletions

View File

@@ -2,6 +2,8 @@
const props = defineProps({ const props = defineProps({
title: String, title: String,
description: String, description: String,
date: String,
type: String,
path: String, path: String,
}); });
</script> </script>
@@ -14,7 +16,13 @@ const props = defineProps({
> >
{{ title }} {{ title }}
</nuxt-link> </nuxt-link>
<p class="text-slate-600"> <div class="flex italic text-xs text-slate-600 items-center space-x-2">
<icon name="material-symbols:calendar-month" />
<p>{{ date }}</p>
<p>|</p>
<p>{{ type }}</p>
</div>
<p class="text-slate-600 pb-2">
{{ description }} {{ description }}
</p> </p>
<nuxt-link :to="path" class="font-semibold group-hover:text-sky-500"> <nuxt-link :to="path" class="font-semibold group-hover:text-sky-500">

View File

@@ -1,14 +1,31 @@
<script setup lang="ts"> <script setup lang="ts">
const route = useRoute(); const route = useRoute();
const routeType = computed(() => {
return route.params.topic || "";
});
const { data } = await useAsyncData("listhero", () =>
queryContent(`/${routeType.value}`).find()
);
const typeName = computed(() => {
return data.value?.at(0)?.type || "";
});
const title = computed(() => { const title = computed(() => {
const path = route.fullPath; const path = route.fullPath;
const splitPath = path.split("/"); const splitPath = path.split("/");
const name = splitPath.at(1); const name = splitPath.at(1);
const tagName = splitPath.at(2);
if (name === "blogs") return "All Blogs Post"; if (name === "blogs") return "All Blogs Post";
else if (name === "tags") return "All Tags"; else if (name === "tags") {
else return "About Me"; if (tagName) {
return `All ${typeName.value} Related Post`;
} else {
return "All Tags";
}
} else return "About Me";
}); });
</script> </script>

View File

@@ -3,7 +3,7 @@ definePageMeta({
layout: "list", layout: "list",
}); });
const { data } = await useAsyncData("home", () => queryContent("/").find()); const { data } = await useAsyncData("about", () => queryContent("/").find());
const getAllPost = computed(() => { const getAllPost = computed(() => {
const allpost = data.value || []; const allpost = data.value || [];

View File

@@ -3,7 +3,7 @@ definePageMeta({
layout: "list", layout: "list",
}); });
const { data } = await useAsyncData("home", () => queryContent("/").find()); const { data } = await useAsyncData("blogs", () => queryContent("/").find());
const getAllPost = computed(() => { const getAllPost = computed(() => {
const allpost = data.value || []; const allpost = data.value || [];

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
const { data } = await useAsyncData("home", () => queryContent("/").find()); const { data } = await useAsyncData("index", () => queryContent("/").find());
// get all the unique types from content // get all the unique types from content
const getTopCategory = computed(() => { const getTopCategory = computed(() => {
@@ -18,6 +18,7 @@ const getRecentContent = computed(() => {
description: post.description, description: post.description,
path: post._path, path: post._path,
date: post.date as string, date: post.date as string,
type: post.type,
}; };
}); });
@@ -42,6 +43,8 @@ const getRecentContent = computed(() => {
:title="rp.title" :title="rp.title"
:description="rp.description" :description="rp.description"
:path="rp.path" :path="rp.path"
:date="rp.date"
:type="rp.type"
/> />
</template> </template>
</div> </div>

View File

@@ -8,7 +8,7 @@ const route = useRoute();
const routeType = computed(() => { const routeType = computed(() => {
return route.params.topic || ""; return route.params.topic || "";
}); });
const { data } = await useAsyncData("home", () => const { data } = await useAsyncData("topic", () =>
queryContent(`/${routeType.value}`).find() queryContent(`/${routeType.value}`).find()
); );
@@ -42,9 +42,6 @@ const getRecentContent = computed(() => {
<div <div
class="container mx-auto max-w-6xl font-ibmmono antialiased min-h-[82vh]" class="container mx-auto max-w-6xl font-ibmmono antialiased min-h-[82vh]"
> >
<h1 class="font-semibold text-3xl mt-10 py-3 mx-5 text-slate-800">
ALL {{ typeName }} POST
</h1>
<div class="flex justify-between flex-wrap"> <div class="flex justify-between flex-wrap">
<template v-for="pp in getRecentContent" :key="pp"> <template v-for="pp in getRecentContent" :key="pp">
<latest-blog-card <latest-blog-card

View File

@@ -2,7 +2,7 @@
definePageMeta({ definePageMeta({
layout: "list", layout: "list",
}); });
const { data } = await useAsyncData("home", () => queryContent("/").find()); const { data } = await useAsyncData("tags", () => queryContent("/").find());
const getTopCategory = computed(() => { const getTopCategory = computed(() => {
const allpost = data.value || []; const allpost = data.value || [];