feat: added target to external blog entrys and bsky link
All checks were successful
Gitea Actions Demo / Build (push) Successful in 1m16s
Gitea Actions Demo / Upload (push) Successful in 8s

This commit is contained in:
2025-09-30 19:15:03 +02:00
parent 5e145e181b
commit 65a909ffea
3 changed files with 16 additions and 3 deletions

View File

@@ -17,7 +17,10 @@
<nav class="media-margin">
<a href="/">Home</a>
<a href="/about">About</a>
<a href="https://bsky.app/profile/amyt3a.bsky.social" aria-label="Link to my Bluesky account"
<a
href="https://bsky.app/profile/amyt3a.bsky.social"
aria-label="Link to my Bluesky account"
target="_blank"
><svg fill="none" class="bsky" viewBox="0 0 64 57"
><path
fill="var(--rp-moon-pine)"

View File

@@ -4,6 +4,7 @@ import type { MDsveXComponent } from '$lib/types';
export interface BlogEntry {
title: string;
src: string;
src_target: string;
img: string;
date: string;
desc: string;
@@ -25,7 +26,16 @@ export function load() {
return [link, val];
})
.sort(([link1, a], [link2, b]) => b.metadata?.date - a.metadata?.date)
.map(([link, val]) => { return { src: link, title: val.metadata.title, img: val.metadata.img, date: new Date(val.metadata.date).toDateString(), desc: val.metadata.desc } })
.map(([link, val]) => {
return {
src: link,
src_target: (link.includes('https://') || link.includes('http://')) ? '_blank' : '',
title: val.metadata.title,
img: val.metadata.img,
date: new Date(val.metadata.date).toDateString(),
desc: val.metadata.desc
}
})
return {
blogs: blog_entries
};

View File

@@ -19,7 +19,7 @@
</p>
</div>
{#each blogs as blog (blog.src)}
<a href={blog.src} class="blog-entry">
<a href={blog.src} target={blog.src_target} class="blog-entry">
<div>
<h4>{blog.title}</h4>
<p>{blog.desc}</p>