Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/blog/BlogPost.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
const { title, url, date, image, tags = [], languages = [] } = Astro.props;
const { title, url, date, image, tags = [], languages = [], hidden = true } = Astro.props;

import Tag from "../ui/Tag.astro";
import ReadMore from "../ui/ReadMore.astro";
Expand Down
2 changes: 1 addition & 1 deletion src/components/blog/LastPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DatePub from "./DatePub.astro";
const latestPost = allPosts.reduce((latest, current) => {
const latestDate = new Date(latest.frontmatter.pubDate).getTime();
const currentDate = new Date(current.frontmatter.pubDate).getTime();
return currentDate > latestDate ? current : latest;
return (currentDate > latestDate && !current.frontmatter.hidden) ? current : latest;
});

const tags = [...new Set(latestPost.frontmatter.tags ?? [])];
Expand Down
13 changes: 13 additions & 0 deletions src/components/blog/ListPosts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ allPosts.sort((a, b) => {
// Filter posts according to props
let postsToShow = allPosts;

postsToShow = postsToShow.filter((post) => {
if (post.frontmatter.hidden) return false; // Exclude hidden posts
return true; // Keep all other posts
});

if (currentPostUrl) {
// Exclude current post if its URL is provided
postsToShow = postsToShow.filter((post) => {
Expand All @@ -38,6 +43,13 @@ if (currentPostUrl) {

// Limit to 4 posts if all is false
if (!all) {
postsToShow = postsToShow.filter((post) => {
if (!post.url) return false; // If no URL, keep the post
// Normalize URLs for comparison
const normalizedPostUrl = post.url.replace(/\/$/, ""); // Remove trailing slash if exists
const normalizedCurrentUrl = currentPostUrl.replace(/\/$/, ""); // Remove trailing slash if exists
return normalizedPostUrl !== normalizedCurrentUrl;
});
postsToShow = postsToShow.slice(0, 4);
}
---
Expand All @@ -63,6 +75,7 @@ if (!all) {
tags={post.frontmatter.tags}
languages={post.frontmatter.languages}
image={post.frontmatter.image}
hidden={post.frontmatter.hidden}
/>
))
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/layout/NavigationArticles.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const allPosts = await Astro.glob("../../pages/blog/posts/*.md");
// Ensure posts have a date before sorting them
const sortedPosts = allPosts
.filter(post => post.frontmatter.pubDate)
.filter(post => !post.frontmatter.hidden) // Exclude hidden posts
.sort((a, b) => new Date(b.frontmatter.pubDate).getTime() - new Date(a.frontmatter.pubDate).getTime());

const currentSlug = Astro.url.pathname.split("/").filter(Boolean).pop();
Expand All @@ -13,8 +14,6 @@ const currentIndex = sortedPosts.findIndex((post) =>
);
const nextPost = currentIndex > 0 ? sortedPosts[currentIndex - 1] : null;
const prevPost = currentIndex < sortedPosts.length - 1 ? sortedPosts[currentIndex + 1] : null;

console.log({ prevPost, nextPost });
---

<nav class="mt-8 flex flex-row gap-2 w-full p-6 max-xl:p-3 max-lg:p-2">
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/MarkdownPostLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ import Heading from "../components/ui/Heading.astro";
>
<div class="white flex items-center gap-4">
<div
aria-label="Photo of Fernando Aldair López Ponce (EFEELE) for the blog"
aria-label="Photo of Pierre-Louis Leclerc (Proxyfil) for the blog"
class="size-10 bg-cover bg-center rounded-full drop-shadow-lg"
style="background-image: url(/images/efeeleprofile.webp);"
style="background-image: url(/images/proxyfil.webp);"
>
</div>
<a
Expand Down
10 changes: 5 additions & 5 deletions src/pages/blog/posts/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import Layout from "../../../layouts/Layout.astro";
import Hero from "../../../components/blog/Hero.astro";
import Tags from "../../../components/blog/Tags.astro";
import ListPosts from "../../../components/blog/ListPosts.astro";
const pageTitle = "Web Development and Technology Blog | Fernando López | EFEELE";
const description = "Welcome to my blog, where I share my passion for frontend development, web design, and the latest technology trends.";
const ogimage = {
url: "/images/blogimage.webp",
alt: "EFEELE.dev logo with green background and light effect. Text: 'Web Development and Technology Blog' and URL 'www.efeele.dev'.",
const pageTitle = "Blog - Pierre-Louis Leclerc | Proxyfil";
const description = "Everything I want to share as a blog.";
const ogimage ={
url: "/images/blogimage.webp",
alt: "proxyfil.fr logo with gold background and light effect. Text: 'Lets learn tech !' and URL 'www.proxyfil.fr'."
};
const currentUrl = `${Astro.site}${Astro.url.pathname}`;
const tweetText = encodeURIComponent(`"${pageTitle}"`);
Expand Down
Loading