Compare commits
No commits in common. "f0acf61023563e673bd395a303231c5d77b02c2c" and "34ddae165b3a9bae3a9e8057c26cd4e32d1c2914" have entirely different histories.
f0acf61023
...
34ddae165b
6 changed files with 13 additions and 9 deletions
|
|
@ -8,7 +8,8 @@ const lang = getLangFromUrl(Astro.url)
|
||||||
const t = useTranslations(lang)
|
const t = useTranslations(lang)
|
||||||
|
|
||||||
const allPosts = await getPostsByLocale(lang)
|
const allPosts = await getPostsByLocale(lang)
|
||||||
const posts = allPosts.slice(0, common.latestPosts)
|
const posts = allPosts
|
||||||
|
.slice(0, common.latestPosts)
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="my-8 text-xl font-medium md:my-8">
|
<div class="my-8 text-xl font-medium md:my-8">
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ pubDate: 2025-11-18
|
||||||
description: "This is the first post of my new Astro blog."
|
description: "This is the first post of my new Astro blog."
|
||||||
author: "@lio@pounced-on.me"
|
author: "@lio@pounced-on.me"
|
||||||
tags: ["furries", "making-friends"]
|
tags: ["furries", "making-friends"]
|
||||||
# published: true
|
|
||||||
---
|
---
|
||||||
|
|
||||||
meow
|
meow
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,16 @@ const urls = {
|
||||||
general: `/images/general/ogImage.png`,
|
general: `/images/general/ogImage.png`,
|
||||||
}
|
}
|
||||||
|
|
||||||
const isPost = post
|
const isPost = Astro.url.pathname.includes("posts")
|
||||||
|
|
||||||
const ogImageURL = new URL(post ? urls.postURL : urls.general, Astro.site).href
|
const ogImageURL = new URL(isPost ? urls.postURL : urls.general, Astro.site)
|
||||||
|
.href
|
||||||
const permalink = new URL(Astro.url.pathname, Astro.site).href
|
const permalink = new URL(Astro.url.pathname, Astro.site).href
|
||||||
const config = lang === "de" ? de : en
|
const config = lang === "de" ? de : en
|
||||||
const title = post
|
const title = isPost
|
||||||
? `${post.title} - ${config.meta.title}`
|
? `${post.title} - ${config.meta.title}`
|
||||||
: `${config.meta.description} - ${config.meta.title}`
|
: `${config.meta.description} - ${config.meta.title}`
|
||||||
const description = post ? post.description : config.meta.description
|
const description = isPost ? post.description : config.meta.description
|
||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ export async function GET(request: { url: URL }) {
|
||||||
return rss({
|
return rss({
|
||||||
title: config.meta.title,
|
title: config.meta.title,
|
||||||
description: config.meta.description,
|
description: config.meta.description,
|
||||||
site: config.meta.url,
|
site:
|
||||||
|
config.meta.url,
|
||||||
items: posts.map((post: any) => ({
|
items: posts.map((post: any) => ({
|
||||||
title: post.data.title,
|
title: post.data.title,
|
||||||
description: post.data.description,
|
description: post.data.description,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ export async function GET() {
|
||||||
return rss({
|
return rss({
|
||||||
title: config.meta.title,
|
title: config.meta.title,
|
||||||
description: config.meta.description,
|
description: config.meta.description,
|
||||||
site: config.meta.url,
|
site:
|
||||||
|
config.meta.url,
|
||||||
items: posts.map((post: any) => ({
|
items: posts.map((post: any) => ({
|
||||||
title: post.data.title,
|
title: post.data.title,
|
||||||
description: post.data.description,
|
description: post.data.description,
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,11 @@ export const getPostsByLocale = async (locale: string) => {
|
||||||
: await getCollection("dePosts")
|
: await getCollection("dePosts")
|
||||||
// Add the locale to the data of each post
|
// Add the locale to the data of each post
|
||||||
|
|
||||||
|
|
||||||
posts.forEach((post: any) => {
|
posts.forEach((post: any) => {
|
||||||
post.data.lang = locale
|
post.data.lang = locale
|
||||||
})
|
})
|
||||||
const filtered = posts.filter((p) => p.data.published)
|
const filtered = posts.filter(p => p.data.published)
|
||||||
return filtered.sort(
|
return filtered.sort(
|
||||||
(a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
(a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue