Skip to content

Commit

Permalink
overhaul blog
Browse files Browse the repository at this point in the history
  • Loading branch information
Reed Nelson committed Aug 11, 2023
1 parent d3b7b7a commit 64d08f4
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"sticky_header": false,
"theme_switcher": true,
"default_theme": "system",
"pagination": 2,
"pagination": 4,
"summary_length": 200,
"blog_folder": "blog"
},
Expand Down
53 changes: 27 additions & 26 deletions src/layouts/BlogPostSingle.astro → src/layouts/BlogSingle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ const { title, description, author, categories, image, date, tags } = post.data;
</div>
)
}
<h1 set:html={markdownify(title)} class="h2 mb-4" />
<h1 set:html={markdownify(title)} class="mb-4" />
<ul class="mb-4">
<li class="mr-4 inline-block">
<a href={`/authors/${slugify(author)}`}>
<FaRegUserCircle className={"mr-2 -mt-1 inline-block"} />
{humanize(author)}
</a>
<FaRegUserCircle className={"mr-2 -mt-1 inline-block"} />
{humanize(author)}
</li>
<li class="mr-4 inline-block">
<FaRegClock className={"mr-2 -mt-1 inline-block"} />
{dateFormat(date)}
</li>
<li class="mr-4 inline-block">
<FaRegFolder className={"mr-2 -mt-1 inline-block"} />
Expand All @@ -58,10 +60,6 @@ const { title, description, author, categories, image, date, tags } = post.data;
))
}
</li>
<li class="mr-4 inline-block">
<FaRegClock className={"mr-2 -mt-1 inline-block"} />
{dateFormat(date)}
</li>
</ul>
<div class="content mb-10">
<Content />
Expand All @@ -75,9 +73,9 @@ const { title, description, author, categories, image, date, tags } = post.data;
<li class="inline-block">
<a
class="m-1 block rounded bg-theme-light px-3 py-1 hover:bg-primary hover:text-white dark:bg-darkmode-theme-light dark:hover:bg-darkmode-primary dark:hover:text-dark"
href={`/blog/tags/${slugify(tag)}`}
href={`blog/tags/${slugify(tag)}`}
>
{humanize(tag)}
{tag}
</a>
</li>
))
Expand All @@ -97,18 +95,21 @@ const { title, description, author, categories, image, date, tags } = post.data;
</article>
</div>

<!-- Related posts -->
<div class="section pb-0">
<h2 class="h3 mb-12 text-center">Related Posts</h2>
<div class="row justify-center">
{
similarPosts.map((post) => (
<div class="lg:col-4">
<BlogCard data={post} />
</div>
))
}
</div>
</div>
</div>
</section>
{
similarPosts.length > 0 && (
<!-- Related posts -->
<div class="section pb-0">
<h2 class="h3 mb-12 text-center">Related Posts</h2>
<div class="row justify-center">
{
similarPosts.slice(0, 3).map((post) => (
<div class="lg:col-4">
<BlogCard data={post} />
</div>
))
}
</div>
</div>
)
}
</section>
23 changes: 11 additions & 12 deletions src/layouts/components/Share.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import config from "@/config/config.json";
import {
IoMail,
IoLogoFacebook,
IoLogoLinkedin,
IoLogoPinterest,
IoLogoTwitter,
} from "react-icons/io5/index.js";
Expand All @@ -18,6 +18,15 @@ const {
---

<ul class={`${className}`}>
<li class="inline-block">
<a href=`mailto:?subject=Article: ${title}&amp;body=Check out this article: ${base_url}/${slug}%0D%0A%0D%0AAbstract:%0D%0A${description}`
title="Share by Email"
target="_blank"
rel="noreferrer noopener"
>
<IoMail />
</a>
</li>
<li class="inline-block">
<a
aria-label="facebook share button"
Expand All @@ -38,16 +47,6 @@ const {
<IoLogoTwitter />
</a>
</li>
<li class="inline-block">
<a
aria-label="linkedin share button"
href={`https://www.linkedin.com/shareArticle?mini=true&url=${base_url}/${slug}&title=${title}&summary=${description}&source=${base_url}`}
target="_blank"
rel="noreferrer noopener"
>
<IoLogoLinkedin />
</a>
</li>
<li class="inline-block">
<a
aria-label="pinterest share button"
Expand All @@ -58,4 +57,4 @@ const {
<IoLogoPinterest />
</a>
</li>
</ul>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const { tags, categories, allCategories } = Astro.props;
class="m-1 block rounded bg-white px-3 py-1 hover:bg-primary hover:text-white dark:bg-darkmode-body dark:hover:bg-darkmode-primary dark:hover:text-dark"
href={`/blog/tags/${tag}`}
>
{humanize(tag)}
{tag}
</a>
</li>
);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/blog/[single].astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
import BlogPostSingle from "@/layouts/BlogPostSingle.astro";
import BlogSingle from "@/layouts/BlogSingle.astro";
import { getSinglePage } from "@/lib/contentParser.astro";
export async function getStaticPaths() {
Expand All @@ -26,5 +26,5 @@ const { title, meta_title, description, image } = post.data;
description={description}
image={image}
>
<BlogPostSingle post={post} />
<BlogSingle post={post} />
</Base>
4 changes: 2 additions & 2 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getSinglePage } from "@/lib/contentParser.astro";
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
import { sortByDate } from "@/lib/utils/sortFunctions";
import PageHeader from "@/partials/PageHeader.astro";
import PostSidebar from "@/partials/PostSidebar.astro";
import BlogSidebar from "@/partials/BlogSidebar.astro";
import { getEntryBySlug } from "astro:content";
const { blog_folder } = config.settings;
Expand Down Expand Up @@ -50,7 +50,7 @@ const currentPosts = sortedPosts.slice(0, config.settings.pagination);
</div>

<!-- sidebar -->
<PostSidebar
<BlogSidebar
categories={categories}
tags={tags}
allCategories={allCategories}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/blog/page/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getSinglePage } from "@/lib/contentParser.astro";
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
import { sortByDate } from "@/lib/utils/sortFunctions";
import PageHeader from "@/partials/PageHeader.astro";
import PostSidebar from "@/partials/PostSidebar.astro";
import BlogSidebar from "@/partials/BlogSidebar.astro";
import { getEntryBySlug } from "astro:content";
const { blog_folder } = config.settings;
Expand Down Expand Up @@ -69,7 +69,7 @@ export async function getStaticPaths() {
</div>

<!-- sidebar -->
<PostSidebar
<BlogSidebar
categories={categories}
tags={tags}
allCategories={allCategories}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/blog/tags/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const allTags = await getAllTaxonomy(blog_folder, "tags");
href={`/blog/tags/${tag}`}
class="block rounded bg-theme-light px-4 py-2 text-xl text-dark dark:bg-darkmode-theme-light dark:text-darkmode-dark"
>
{humanize(tag)}{" "}
{tag}{" "}
<span class="ml-2 rounded bg-body px-2 dark:bg-darkmode-body">
{count}
</span>
Expand Down

0 comments on commit 64d08f4

Please sign in to comment.