make index page dynamic

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2022-12-19 23:23:12 +06:00
parent 16be1385b6
commit 4ef9100efc
10 changed files with 197 additions and 32 deletions

View File

@@ -1,15 +1,25 @@
<script setup lang="ts">
const props = defineProps({
title: String,
description: String,
path: String,
});
</script>
<template> <template>
<div class="space-y-2 my-5 text-slate-800 group"> <div class="space-y-2 my-5 text-slate-800 group">
<h3 class="text-xl font-semibold group-hover:text-sky-500"> <nuxt-link
This is a blog title :to="path"
</h3> class="text-xl font-semibold group-hover:text-sky-500"
>
{{ title }}
</nuxt-link>
<p class="text-slate-600"> <p class="text-slate-600">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quidem, deserunt {{ description }}
esse tenetur iusto dolor unde. Aliquam quidem ab qui velit?
</p> </p>
<p class="font-semibold group-hover:text-sky-500"> <nuxt-link :to="path" class="font-semibold group-hover:text-sky-500">
Read more Read more
<span class="hidden group-hover:inline"> ->> </span> <span class="hidden group-hover:inline"> ->> </span>
</p> </nuxt-link>
</div> </div>
</template> </template>

View File

@@ -1,11 +1,18 @@
<script setup lang="ts">
const props = defineProps({
title: String,
path: String,
});
</script>
<template> <template>
<div class="group font-semibold antialiased text-slate-800 font-ibmmono"> <div class="group font-semibold antialiased text-slate-800 font-ibmmono">
<nuxt-link class="flex items-baseline space-x-3" to="/"> <nuxt-link class="flex items-baseline space-x-3" :to="path">
<div class="group-hover:scale-125 transition"> <div class="group-hover:scale-125 transition">
<icon name="ant-design:arrow-right-outlined" /> <icon name="ant-design:arrow-right-outlined" />
</div> </div>
<h4 class="group-hover:underline"> <h4 class="group-hover:underline">
How to use vite in your nuxt 3 project a a a riyad {{ title }}
</h4> </h4>
</nuxt-link> </nuxt-link>
</div> </div>

View File

@@ -1,7 +0,0 @@
<template>
<button
class="bg-[#a2d9ff] px-2 py-1 m-2 transition hover:scale-105 rounded-md"
>
Javascript
</button>
</template>

View File

@@ -1,5 +1,20 @@
<script setup lang="ts">
const props = defineProps({
title: String,
});
const router = useRouter();
const onClick = () => {
router.push(`/tags/${props.title}`);
};
</script>
<template> <template>
<div> <button
<topic-btn v-for="n in 7" :key="n" /> @click="onClick"
</div> class="bg-[#a2d9ff] px-2 py-1 m-2 transition hover:scale-105 rounded-md"
>
{{ title }}
</button>
</template> </template>

View File

@@ -1 +1,20 @@
sdlfjksldfkj ---
title: "Title of the page 4sdf"
description: "meta description of the page"
draft: false
head: true
author: riyad
date: 26 Jan 2022
type: Docker
---
# Hi there!
This Markdown file creates a page at `your-domain.com/page-1/`
It probably isn't styled much, but Markdown does support:
- **bold** and _italics._
- lists
- [links](https://astro.build)
- and more!

View File

@@ -1,8 +1,11 @@
--- ---
Title: This is a title title: "Title of the page"
type: javascript description: "meta description of the page"
time: 22-12-2022 draft: false
Author: riyad head: true
author: riyad
date: 22 Jan 2022
type: JavaScript
--- ---
::info-component ::info-component

47
content/js/hellojs2.md Normal file
View File

@@ -0,0 +1,47 @@
---
title: "Title of the page 2"
description: "meta description of the page 2"
draft: false
head: true
author: riyad
date: 23 Jan 2022
type: JavaScript
---
::info-component
#time
22 January 2022
#author
by Md. [Al Asad Nur Riyad](https://www.nurriyad.xyz)
::
# How to install nuxt 3
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley
## Step 01
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<img src="/img/sdf.jpg" class="mx-auto" alt="drawing" width="200"/>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
## This is a sub header
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
[google](google.com)
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

View File

@@ -1,9 +1,11 @@
--- ---
title: Hello, World title: "Title of the page 3"
description: "meta description of the page"
draft: false
head: true
author: riyad author: riyad
date: 10:11:12 date: 24 Jan 2022
category: js type: Typescript
summery: sdklfjsld
--- ---
# Hi there! # Hi there!

20
content/ts/hellots2.md Normal file
View File

@@ -0,0 +1,20 @@
---
title: "Title of the page 4"
description: "meta description of the page"
draft: false
head: true
author: riyad
date: 25 Jan 2022
type: Typescript
---
# Hi there!
This Markdown file creates a page at `your-domain.com/page-1/`
It probably isn't styled much, but Markdown does support:
- **bold** and _italics._
- lists
- [links](https://astro.build)
- and more!

View File

@@ -1,5 +1,42 @@
<script setup lang="ts"> <script setup lang="ts">
let x = ref(10); const { data } = await useAsyncData("home", () => queryContent("/").find());
const getTopCategory = computed(() => {
const allpost = data.value || [];
const alltypes = allpost.map((post) => post.type);
const uniqType = new Set(alltypes);
return uniqType;
});
const getRecentContent = computed(() => {
const allpost = data.value || [];
const alltypes = allpost.map((post) => {
return {
title: post.title,
description: post.description,
path: post._path,
date: post.date as string,
};
});
alltypes.sort(function (a, b) {
const c = new Date(a.date);
const d = new Date(b.date);
return c < d ? 1 : -1;
});
return alltypes;
});
const getPopularContent = computed(() => {
const allpost = data.value || [];
const alltypes = allpost.map((post) => {
return {
title: post.title,
path: post._path,
};
});
return alltypes;
});
</script> </script>
<template> <template>
@@ -9,16 +46,28 @@ let x = ref(10);
<div class="flex-1"> <div class="flex-1">
<h1 class="text-xl pb-8 text-[#e60067]">RECENTLY PUBLISHED</h1> <h1 class="text-xl pb-8 text-[#e60067]">RECENTLY PUBLISHED</h1>
<div class="space-y-8"> <div class="space-y-8">
<blog-card v-for="n in 7" :key="n" /> <template v-for="rp in getRecentContent" :key="rp">
<blog-card
:title="rp.title"
:description="rp.description"
:path="rp.path"
/>
</template>
</div> </div>
</div> </div>
<div class="max-w-[400px]"> <div class="max-w-[400px]">
<div> <div>
<h2 class="text-xl pb-8 text-[#e60067]">TOP CATEGORIES</h2> <h2 class="text-xl pb-8 text-[#e60067]">TOP CATEGORIES</h2>
<topic-card />
<template v-for="cat in getTopCategory" :key="cat">
<topic-card :title="cat" />
</template>
<h2 class="text-xl py-8 text-[#e60067]">POPULAR CONTENT</h2> <h2 class="text-xl py-8 text-[#e60067]">POPULAR CONTENT</h2>
<div class="space-y-5"> <div class="space-y-5">
<one-line-card v-for="n in 5" :key="n" /> <template v-for="pp in getPopularContent" :key="pp">
<one-line-card :title="pp.title" :path="pp.path" />
</template>
</div> </div>
</div> </div>
</div> </div>