fixes to get the compile actually working (slightly hacky lol)
This commit is contained in:
parent
48fc1c29a6
commit
ddf2eed21e
21 changed files with 88 additions and 127 deletions
|
@ -41,10 +41,9 @@ export default defineConfig({
|
|||
},
|
||||
|
||||
integrations: [react(), tailwind(), mdx({
|
||||
syntaxHighlight: 'false',
|
||||
syntaxHighlight: false,
|
||||
remarkPlugins: [[m2dx, m2dxOptions]],
|
||||
rehypePlugins: [rehypeSlug, [rehypeMdxCodeProps, {tagName: 'code'}]],
|
||||
extendDefaultPlugins: true,
|
||||
}), icon()],
|
||||
|
||||
output: 'server',
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"start": "astro start -p 8080",
|
||||
"build": "astro check && astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
|
@ -29,7 +29,6 @@
|
|||
"feed": "^4.2.2",
|
||||
"github-slugger": "^2.0.0",
|
||||
"linkedom": "^0.18.5",
|
||||
"lodash": "^4.17.21",
|
||||
"prism": "^4.1.2",
|
||||
"prism-react-renderer": "^2.4.0",
|
||||
"react": "^18.3.1",
|
||||
|
@ -45,8 +44,10 @@
|
|||
},
|
||||
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c",
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.17.13",
|
||||
"astro-auto-import": "^0.4.4",
|
||||
"astro-mdx-code-blocks": "^0.0.6",
|
||||
"lodash": "^4.17.21",
|
||||
"node-html-parser": "^6.1.13"
|
||||
}
|
||||
}
|
||||
|
|
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
|
@ -65,9 +65,6 @@ importers:
|
|||
linkedom:
|
||||
specifier: ^0.18.5
|
||||
version: 0.18.5
|
||||
lodash:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
prism:
|
||||
specifier: ^4.1.2
|
||||
version: 4.1.2(react@18.3.1)
|
||||
|
@ -105,12 +102,18 @@ importers:
|
|||
specifier: ^5.6.2
|
||||
version: 5.6.2
|
||||
devDependencies:
|
||||
'@types/lodash':
|
||||
specifier: ^4.17.13
|
||||
version: 4.17.13
|
||||
astro-auto-import:
|
||||
specifier: ^0.4.4
|
||||
version: 0.4.4(astro@4.16.10(@types/node@18.19.55)(rollup@4.24.0)(typescript@5.6.2))
|
||||
astro-mdx-code-blocks:
|
||||
specifier: ^0.0.6
|
||||
version: 0.0.6(astro@4.16.10(@types/node@18.19.55)(rollup@4.24.0)(typescript@5.6.2))
|
||||
lodash:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
node-html-parser:
|
||||
specifier: ^6.1.13
|
||||
version: 6.1.13
|
||||
|
@ -835,6 +838,9 @@ packages:
|
|||
'@types/hast@3.0.4':
|
||||
resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
|
||||
|
||||
'@types/lodash@4.17.13':
|
||||
resolution: {integrity: sha512-lfx+dftrEZcdBPczf9d0Qv0x+j/rfNCMuC6OcfXmO8gkfeNAY88PgKUbvG56whcN23gc27yenwF6oJZXGFpYxg==}
|
||||
|
||||
'@types/mdast@3.0.15':
|
||||
resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==}
|
||||
|
||||
|
@ -4058,6 +4064,8 @@ snapshots:
|
|||
dependencies:
|
||||
'@types/unist': 3.0.3
|
||||
|
||||
'@types/lodash@4.17.13': {}
|
||||
|
||||
'@types/mdast@3.0.15':
|
||||
dependencies:
|
||||
'@types/unist': 2.0.11
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import HR from '/src/components/HR.astro'
|
||||
import MDXImage from '/src/components/mdx/MDXImage.astro'
|
||||
import MDXCallout from '/src/components/mdx/MDXCallout.astro'
|
||||
import MDXCodeBlock from '/src/components/mdx/MDXCodeBlock.astro'
|
||||
import HR from './components/HR.astro'
|
||||
import MDXImage from './components/mdx/MDXImage.astro'
|
||||
import MDXCallout from './components/mdx/MDXCallout.astro'
|
||||
import MDXCodeBlock from './components/mdx/MDXCodeBlock.astro'
|
||||
|
||||
export const components = {
|
||||
hr: HR,
|
||||
|
|
|
@ -11,14 +11,17 @@ const iconClass = 'fill-current hover:fill-crusta-800 dark:hover:fill-night-400'
|
|||
<HR/>
|
||||
<div class="flex items-center">contact — 
|
||||
<a href='https://plush.city/@kebokyo' target='_blank' rel='noopener noreferrer' aria-label="fediverse">
|
||||
{/* @ts-ignore */}
|
||||
<Icon icon="PiFediverseLogoFill" class={iconClass} title="fediverse" aria-label="fediverse"/>
|
||||
</a>
|
||||
 
|
||||
<a href='https://bsky.app/profile/kebokyo.eleboog.com' target='_blank' rel='noopener noreferrer' aria-label="bluesky">
|
||||
{/* @ts-ignore */}
|
||||
<Icon icon="FaBluesky" class={iconClass} title="bluesky" aria-label="bluesky"/>
|
||||
</a>
|
||||
 
|
||||
<a href='mailto:kebokyo@eleboog.com' target='_blank' rel='noopener noreferrer' aria-label="email">
|
||||
{/* @ts-ignore */}
|
||||
<Icon icon="MdMail" class={iconClass} title="email" aria-label="email"/>
|
||||
</a>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { parse } from 'node-html-parser';
|
|||
// https://ellodave.dev/blog/article/using-svgs-as-astro-components-and-inline-css/
|
||||
|
||||
export interface Props {
|
||||
icon: string;
|
||||
icon: string
|
||||
}
|
||||
|
||||
function getSVG(name: string) {
|
||||
|
@ -21,6 +21,7 @@ function getSVG(name: string) {
|
|||
const root = parse(files[filepath]);
|
||||
|
||||
const svg = root.querySelector('svg');
|
||||
// @ts-ignore
|
||||
const { attributes, innerHTML } = svg;
|
||||
|
||||
return {
|
||||
|
@ -29,7 +30,7 @@ function getSVG(name: string) {
|
|||
};
|
||||
}
|
||||
|
||||
const { icon, ...attributes } = Astro.props as Props;
|
||||
const { icon, ...attributes } = Astro.props;
|
||||
const { attributes: baseAttributes, innerHTML } = getSVG(icon);
|
||||
|
||||
const svgAttributes = { ...baseAttributes, ...attributes };
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
//import { CodeBlock } from 'react-code-block';
|
||||
//import { themes } from 'prism-react-renderer';
|
||||
import { Highlight } from 'prism-react-renderer';
|
||||
|
@ -46,14 +48,15 @@ let filename: string = '';
|
|||
|
||||
const code_html = await Astro.slots.render('default');
|
||||
|
||||
// @ts-ignore
|
||||
const renderCode = (html) => {
|
||||
const { document } = parseHTML(html);
|
||||
const child = document.children
|
||||
const match = /language-(\w+)/.exec(child[0].className);
|
||||
lang = match ? match[1] : 'plaintext';
|
||||
|
||||
const match2 = /filename="(.*?)"/.exec(child[0].getAttribute('metastring'))
|
||||
filename = match2 ? match2[1] : null;
|
||||
const match2 = /filename="(.*?)"/.exec(child[0].getAttribute('metastring') ?? '')
|
||||
filename = match2 ? match2[1] : '';
|
||||
//console.log(match)
|
||||
return unescape(child[0].innerHTML);
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
import { Post } from "@/.contentlayer/generated"
|
||||
import MDXImage from "./MDXImage"
|
||||
|
||||
import { format, parseISO } from 'date-fns'
|
||||
|
||||
export default function PostHeader(post: Post) {
|
||||
|
||||
const numberToWord = (num: number) => {
|
||||
switch(num) {
|
||||
case 1: return "one";
|
||||
case 2: return "two";
|
||||
case 3: return "three";
|
||||
case 4: return "four";
|
||||
}
|
||||
}
|
||||
|
||||
return (<>
|
||||
{ ( post.cover && post.cover_alt ) ? (
|
||||
<div className="mb-4">
|
||||
<MDXImage src={post.cover} alt={post.cover_alt}/>
|
||||
</div>
|
||||
) : '' }
|
||||
|
||||
<h1 className="text-4xl font-serif font-bold text-title">{post.title}</h1>
|
||||
<h2 className="font-mono">— {format(parseISO(post.date), 'LLLL d, yyyy')}
|
||||
{(post.updated) ? (
|
||||
<span>, <span className="text-subtitle">updated {format(parseISO(post.updated), 'LLLL d, yyyy')}</span></span>
|
||||
) : ''}
|
||||
</h2>
|
||||
<h2 className="text-sm italic mb-4 text-subtitle">{post.summary}</h2>
|
||||
|
||||
{(post.toc) ? ( <>
|
||||
<h3 className="font-mono text-xl text-title">table of contents</h3>
|
||||
<div id="toc" className="mb-4 ml-2 pl-2 border-l border-neutral-400 ">
|
||||
{post.headings.map((heading: {level: number, text: string, slug: string}) => {
|
||||
return (
|
||||
<div key={`#${heading.slug}`}>
|
||||
<a className="font-serif text-sm text-subtitle hover:underline data-[level=two]:pl-3 data-[level=three]:pl-6" data-level={numberToWord(heading.level)} href={'#' + heading.slug}>
|
||||
{(heading.level > 1) ? '> ' : ''}
|
||||
{heading.text}
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>):''}
|
||||
</>)
|
||||
}
|
|
@ -20,7 +20,7 @@ const { title } = Astro.props
|
|||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title ? title + ' - eleboog.com' : 'eleboog.com'}</title>
|
||||
</head>
|
||||
<body class="flex-col mx-auto min-h-screen max-w-screen-md p-8 py-4"">
|
||||
<body class="flex-col mx-auto min-h-screen max-w-screen-md p-8 py-4">
|
||||
<Header current={title}/>
|
||||
<main>
|
||||
<slot/>
|
||||
|
|
|
@ -6,6 +6,7 @@ import '../styles/markdown.css'
|
|||
|
||||
import { format } from 'date-fns'
|
||||
import { toZonedTime } from 'date-fns-tz'
|
||||
import { timeZone } from "../lib/utils";
|
||||
|
||||
import Header from '../components/Header.astro'
|
||||
import Footer from '../components/Footer.astro'
|
||||
|
@ -13,8 +14,6 @@ import MDXImage from '../components/mdx/MDXImage.astro'
|
|||
|
||||
import HR from '../components/HR.astro'
|
||||
|
||||
import { mdxComponents } from '@l/mdx.tsx';
|
||||
|
||||
const fm = Astro.props.frontmatter
|
||||
const headings = await Astro.props.headings
|
||||
|
||||
|
@ -40,7 +39,7 @@ const numberToWord = (num: number) => {
|
|||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title ? title + ' - eleboog.com' : 'eleboog.com'}</title>
|
||||
</head>
|
||||
<body class="flex-col mx-auto min-h-screen max-w-screen-md p-8 py-4"">
|
||||
<body class="flex-col mx-auto min-h-screen max-w-screen-md p-8 py-4">
|
||||
<Header current='blog post'/>
|
||||
<main>
|
||||
{ ( fm.cover && fm.cover_alt ) ? (
|
||||
|
@ -50,9 +49,9 @@ const numberToWord = (num: number) => {
|
|||
) : '' }
|
||||
|
||||
<h1 class="text-4xl font-serif font-bold text-title">{fm.title}</h1>
|
||||
<h2 class="font-mono">— {format(toZonedTime(fm.date), 'LLLL d, yyyy')}
|
||||
<h2 class="font-mono">— {format(toZonedTime(fm.date, timeZone), 'LLLL d, yyyy')}
|
||||
{(fm.updated) ? (
|
||||
<span>, <span class="text-subtitle">updated {format(toZonedTime(fm.updated), 'LLLL d, yyyy')}</span></span>
|
||||
<span>, <span class="text-subtitle">updated {format(toZonedTime(fm.updated, timeZone), 'LLLL d, yyyy')}</span></span>
|
||||
) : ''}
|
||||
</h2>
|
||||
<h2 class="text-sm italic mb-4 mt-2 text-subtitle">{fm.summary}</h2>
|
||||
|
@ -73,7 +72,7 @@ const numberToWord = (num: number) => {
|
|||
<div id="toc" class="mb-4 ml-2 pl-2 border-l border-neutral-400 ">
|
||||
{headings.map((heading: {depth: number, slug: string, text: string}) => {
|
||||
return (
|
||||
<div key={`#${heading.slug}`}>
|
||||
<div>
|
||||
<a class="font-serif text-sm text-subtitle hover:underline data-[level=two]:pl-3 data-[level=three]:pl-6" data-level={numberToWord(heading.depth)} href={'#' + heading.slug}>
|
||||
{(heading.depth > 1) ? '> ' : ''}
|
||||
{heading.text}
|
||||
|
|
|
@ -9,8 +9,6 @@ import Footer from '../components/Footer.astro'
|
|||
|
||||
import HR from '../components/HR.astro'
|
||||
|
||||
import { mdxComponents } from '@l/mdx.tsx';
|
||||
|
||||
const { frontmatter } = Astro.props
|
||||
|
||||
const title = frontmatter.slug ?? 'me'
|
||||
|
@ -26,14 +24,14 @@ const title = frontmatter.slug ?? 'me'
|
|||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title ? title + ' - eleboog.com' : 'eleboog.com'}</title>
|
||||
</head>
|
||||
<body class="flex-col mx-auto min-h-screen max-w-screen-md p-8 py-4"">
|
||||
<body class="flex-col mx-auto min-h-screen max-w-screen-md p-8 py-4">
|
||||
<Header current={title}/>
|
||||
<main>
|
||||
<h1 class="text-3xl font-serif my-2">{frontmatter.title}</h1>
|
||||
<h2 class="text-sm mb-4 text-subtitle">{frontmatter.summary}</h2>
|
||||
|
||||
<article>
|
||||
<slot components={{hr: HR}}/>
|
||||
<slot />
|
||||
</article>
|
||||
</main>
|
||||
<Footer/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export allTags = [
|
||||
export const allTags = [
|
||||
// type of content
|
||||
"meta", "reply", "self-promo", "rant", "critique", "tutorial"
|
||||
"meta", "reply", "self-promo", "rant", "critique", "tutorial",
|
||||
// mood
|
||||
"silly", "angry", "curious", "happy", "sad", "introspective",
|
||||
// topic
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { getCollection, getEntry } from "astro:content";
|
||||
import { getCollection } from "astro:content";
|
||||
import { Feed } from "feed";
|
||||
|
||||
import { compareDesc } from "date-fns"
|
||||
import { toZonedTime } from 'date-fns-tz'
|
||||
|
||||
import sfjson from '/src/data/sharefeed.json'
|
||||
import type { ShareFeedEntry } from "/src/lib/utils";
|
||||
import sfjson from '../data/sharefeed.json'
|
||||
import type { ShareFeedEntry } from "../lib/utils";
|
||||
|
||||
export const baseURL = "localhost:4321"//"https://eleboog.com"
|
||||
export const author = {
|
||||
|
@ -14,6 +14,8 @@ export const author = {
|
|||
link: baseURL
|
||||
};
|
||||
|
||||
import { timeZone } from "./utils";
|
||||
|
||||
export async function computeFeed() {
|
||||
const mainFeed = new Feed({
|
||||
title: "eleboog.com feed",
|
||||
|
@ -63,7 +65,7 @@ export function addSharefeedEntriesToFeed(feed: Feed, main?: boolean) {
|
|||
author: [{
|
||||
name: entry.author
|
||||
}],
|
||||
date: toZonedTime(entry.date)
|
||||
date: toZonedTime(entry.date, timeZone)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -71,11 +73,11 @@ export function addSharefeedEntriesToFeed(feed: Feed, main?: boolean) {
|
|||
export async function addPostsToFeed(feed: Feed, main?: boolean) {
|
||||
const posts = await getCollection('posts')
|
||||
|
||||
posts.sort((a:Post,b:Post) => compareDesc(new Date(a.data.date), new Date(b.data.date)))
|
||||
.filter((post:Post) => !post.data.draft)
|
||||
posts.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date)))
|
||||
.filter((post) => !post.data.draft)
|
||||
.slice(0,20);
|
||||
|
||||
posts.forEach((post: Post) => {
|
||||
posts.forEach((post) => {
|
||||
const url: string = `${baseURL}/posts/${post.id}`
|
||||
let title: string = '';
|
||||
if (main) {
|
||||
|
@ -90,7 +92,7 @@ export async function addPostsToFeed(feed: Feed, main?: boolean) {
|
|||
description: post.data.summary ?? "Whoops, I didn't write a summary for this. Yell at me that I need to do so.",
|
||||
content: post.data.summary ?? "Whoops, I didn't write a summary for this. Yell at me that I need to do so.",
|
||||
author: [author],
|
||||
date: toZonedTime(post.data.date),
|
||||
date: toZonedTime(post.data.date, timeZone),
|
||||
});
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@ export type ShareFeedEntry = {
|
|||
title: string,
|
||||
note: string,
|
||||
draft?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export const timeZone = "America/Chicago";
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
---
|
||||
|
||||
import { compareDesc, format, parseISO } from 'date-fns'
|
||||
import { fromZonedTime, toZonedTime } from 'date-fns-tz'
|
||||
import { compareDesc, format } from 'date-fns'
|
||||
import { toZonedTime } from 'date-fns-tz'
|
||||
import { timeZone } from "../lib/utils";
|
||||
|
||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
||||
import cri from "./chills_going_waaaaah.png"
|
||||
import { Picture } from 'astro:assets';
|
||||
|
||||
import HR from "../components/HR.astro"
|
||||
|
||||
import { getCollection, getEntry } from 'astro:content';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
const posts = await getCollection('posts');
|
||||
const archives = await getCollection('archives');
|
||||
|
@ -22,13 +21,13 @@ const archives = await getCollection('archives');
|
|||
|
||||
<h2 class="text-2xl font-serif text-crusta-600 dark:text-night-200 my-2">current content</h2>
|
||||
<ul class="space-y-2">
|
||||
{posts.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date))).map((post, idx, array) => {
|
||||
if (post.data.archive) return;
|
||||
console.log(toZonedTime(post.data.date));
|
||||
{posts.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date))).map((post) => {
|
||||
if (post.data.draft) return;
|
||||
console.log(toZonedTime(post.data.date, timeZone));
|
||||
return (
|
||||
<li key={idx}>
|
||||
<li>
|
||||
<a href={'/posts/' + post.slug} class="font-serif text-lg text-crusta-400 dark:text-night-300 hover:underline">{post.data.title}</a>
|
||||
 <span class="font-mono text-md">{format(toZonedTime(post.data.date), 'LLL d, yyyy')}</span>
|
||||
 <span class="font-mono text-md">{format(toZonedTime(post.data.date, timeZone), 'LLL d, yyyy')}</span>
|
||||
<p>{post.data.summary}</p>
|
||||
</li>
|
||||
);
|
||||
|
@ -42,13 +41,13 @@ const archives = await getCollection('archives');
|
|||
Please check the date of publication before making any comments.</p>
|
||||
|
||||
<ul class="space-y-2">
|
||||
{archives.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date))).map((post, idx, array) => {
|
||||
if (post.data.archive) return;
|
||||
console.log(toZonedTime(post.data.date));
|
||||
{archives.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date))).map((post) => {
|
||||
if (post.data.draft) return;
|
||||
console.log(toZonedTime(post.data.date, timeZone));
|
||||
return (
|
||||
<li key={idx}>
|
||||
<li>
|
||||
<a href={'/posts/' + post.slug} class="font-serif text-lg text-crusta-400 dark:text-night-300 hover:underline">{post.data.title}</a>
|
||||
 <span class="font-mono text-md">{format(toZonedTime(post.data.date), 'LLL d, yyyy')}</span>
|
||||
 <span class="font-mono text-md">{format(toZonedTime(post.data.date, timeZone), 'LLL d, yyyy')}</span>
|
||||
<p>{post.data.summary}</p>
|
||||
</li>
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { computeFeed } from "/src/lib/feed.ts";
|
||||
import { computeFeed } from "../../lib/feed.ts";
|
||||
import type { APIContext } from 'astro';
|
||||
|
||||
export async function GET({request, url, cookies}: APIContext): Promise<Response> {
|
||||
export async function GET(context: APIContext): Promise<Response> {
|
||||
const feed = await computeFeed();
|
||||
|
||||
return new Response(feed.json1())
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { computeFeed, injectXSL } from "/src/lib/feed.ts";
|
||||
import type { APIContext } from 'astro';
|
||||
import { computeFeed, injectXSL } from "../../lib/feed.ts";
|
||||
|
||||
export async function GET({request, url, cookies}: APIContext): Promise<Response> {
|
||||
export async function GET(): Promise<Response> {
|
||||
const feed = await computeFeed();
|
||||
|
||||
return new Response(injectXSL(feed.atom1(), "/feed.xsl"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
import { compareDesc, format, parseISO } from 'date-fns'
|
||||
import { fromZonedTime, toZonedTime } from 'date-fns-tz'
|
||||
import { compareDesc, format } from 'date-fns'
|
||||
import { toZonedTime } from 'date-fns-tz'
|
||||
|
||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
||||
import cri from "./chills_going_waaaaah.png"
|
||||
|
@ -9,10 +9,12 @@ import { Picture } from 'astro:assets';
|
|||
|
||||
import MDXCallout from "../components/mdx/MDXCallout.astro"
|
||||
|
||||
import { getCollection, getEntry } from 'astro:content';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
const posts = await getCollection('posts')
|
||||
|
||||
import { timeZone } from "../lib/utils";
|
||||
|
||||
---
|
||||
|
||||
<BaseLayout title="home">
|
||||
|
@ -44,13 +46,13 @@ const posts = await getCollection('posts')
|
|||
|
||||
<h2 class="font-serif text-2xl mb-2">recent posts</h2>
|
||||
<ul class="space-y-2">
|
||||
{posts.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date))).map((post, idx, array) => {
|
||||
{posts.sort((a, b) => compareDesc(new Date(a.data.date), new Date(b.data.date))).map((post, idx) => {
|
||||
if (idx >= 3 || post.data.draft) return;
|
||||
console.log(toZonedTime(post.data.date));
|
||||
console.log(toZonedTime(post.data.date, timeZone));
|
||||
return (
|
||||
<li key={idx}>
|
||||
<li >
|
||||
<a href={'/posts/' + post.slug} class="font-serif text-lg text-crusta-400 dark:text-night-300 hover:underline">{post.data.title}</a>
|
||||
 <span class="font-mono text-md">{format(toZonedTime(post.data.date), 'LLL d, yyyy')}</span>
|
||||
 <span class="font-mono text-md">{format(toZonedTime(post.data.date, timeZone), 'LLL d, yyyy')}</span>
|
||||
<p>{post.data.summary}</p>
|
||||
</li>
|
||||
);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { compareDesc, format, parseISO } from 'date-fns'
|
||||
import { fromZonedTime, toZonedTime } from 'date-fns-tz'
|
||||
import { compareDesc } from 'date-fns'
|
||||
|
||||
import { getCollection, getEntry } from 'astro:content';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
import type { APIRoute } from 'astro';
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
export const prerender = true;
|
||||
|
||||
import {getCollection} from 'astro:content'
|
||||
import PostLayout from '../../layouts/PostLayout.astro'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection('posts');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
import { compareDesc, format, parseISO } from 'date-fns'
|
||||
import { compareDesc, format } from 'date-fns'
|
||||
import { toZonedTime } from 'date-fns-tz'
|
||||
|
||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
||||
|
@ -8,13 +8,11 @@ import BaseLayout from '../layouts/BaseLayout.astro';
|
|||
import HR from "../components/HR.astro";
|
||||
import MDXCallout from '../components/mdx/MDXCallout.astro';
|
||||
|
||||
import { getCollection, getEntry } from 'astro:content';
|
||||
|
||||
import sfjson from "../data/sharefeed.json";
|
||||
import type { ShareFeedEntry } from "../lib/utils";
|
||||
|
||||
const entries = sfjson.sharefeed
|
||||
.sort((a:ShareFeedEntry,b:ShareFeedEntry) => compareDesc(new Date(a.posted), new Date(b.posted)))
|
||||
.sort((a:ShareFeedEntry,b:ShareFeedEntry) => compareDesc(new Date(a.date), new Date(b.date)))
|
||||
.filter((entry: ShareFeedEntry) => !(entry.draft))
|
||||
|
||||
---
|
||||
|
@ -28,10 +26,9 @@ const entries = sfjson.sharefeed
|
|||
|
||||
<HR/>
|
||||
|
||||
<ul classs="space-y-2">
|
||||
{entries.map((entry: ShareFeedEntry, idx: number, array: ShareFeedEntry[]) => (
|
||||
<>
|
||||
<li key={idx} class="mb-2">
|
||||
<ul class="space-y-2">
|
||||
{entries.map((entry: ShareFeedEntry) => (
|
||||
<li class="mb-2">
|
||||
<a href={entry.url} class="font-serif text-lg text-crusta-400 dark:text-night-300 hover:underline">
|
||||
{entry.author ? `${entry.author}: ` : ''}
|
||||
{entry.title}
|
||||
|
@ -43,8 +40,6 @@ const entries = sfjson.sharefeed
|
|||
</p>
|
||||
<p>{entry.note}</p>
|
||||
</li>
|
||||
{((idx + 1) % 10 == 0) ? (<HR/>) : ''}
|
||||
</>
|
||||
))}
|
||||
</ul>
|
||||
</BaseLayout>
|
||||
|
|
Loading…
Add table
Reference in a new issue