diff --git a/src/components/RandomPosts.astro b/src/components/RandomPosts.astro
new file mode 100644
index 0000000..9149bc1
--- /dev/null
+++ b/src/components/RandomPosts.astro
@@ -0,0 +1,16 @@
+---
+import Post from '../components/Post.astro';
+
+const { allPosts } = Astro.props;
+
+let posts = allPosts.sort(() => 0.5 - Math.random()).slice(0, 3)
+---
+
+
+
+ {posts.map(
+ ({url, frontmatter: { description, slug, title, tags, added: date }}) => (
+
+ ))}
+
+
\ No newline at end of file
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 007bf2d..e5aaf85 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -2,9 +2,31 @@
import BaseHead from '../components/BaseHead.astro';
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
+import RandomPosts from '../components/RandomPosts.astro';
import ColorScript from '../components/ColorScript.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../config';
-import {Content as About} from './about.md';
+import { Content as About } from './about.md';
+
+const posts = (await Astro.glob('../posts/*.{md,mdx}'));
+
+// Get tags from all posts
+const getTags = posts.map((post) => {
+ const postTags = post.frontmatter.tags;
+ let allTags = []
+
+ if (postTags.length > 0) {
+ postTags.forEach((tag) => {
+ if (allTags.indexOf(tag) === -1) {
+ allTags.push(tag);
+ }
+ });
+ }
+ return allTags;
+}).flat(1);
+// Make the tags unique
+let tags = [...new Set(getTags)];
+
+
---
@@ -18,10 +40,14 @@ import {Content as About} from './about.md';
Here's a sampler of some posts
- hello blah blah blah
+
View posts by tag
- hello blah blah blah
+
+ {tags && tags.map(tag => (
+ <>#{tag}{` `}>
+ ))}
+