refactor: cleans up some unused suffix code until we figure out how to reimplement
This commit is contained in:
parent
2a2331e79f
commit
8209d036cd
3 changed files with 4 additions and 12 deletions
|
|
@ -30,12 +30,10 @@ export function formatListItem(
|
||||||
date: Date,
|
date: Date,
|
||||||
url: string,
|
url: string,
|
||||||
title: string,
|
title: string,
|
||||||
options?: { pinned?: boolean; suffix?: string; prefix?: string }
|
options?: { pinned?: boolean }
|
||||||
): string {
|
): string {
|
||||||
const pinnedBadge = options?.pinned ? ' [pinned]' : '';
|
const pinnedBadge = options?.pinned ? ' [pinned]' : '';
|
||||||
const suffix = options?.suffix ? ` ${options.suffix}` : '';
|
return `<span class="list-meta"><span class="muted">${formatDate(date)}</span></span><span class="entry-content"><a href="${url}" title="${title}">${title}</a>${pinnedBadge}</span>`;
|
||||||
const prefix = options?.prefix ?? '';
|
|
||||||
return `<span class="list-meta">${prefix}<span class="muted">${formatDate(date)}</span></span><span class="entry-content"><a href="${url}" title="${title}">${title}</a>${pinnedBadge}${suffix}</span>`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Sortable {
|
interface Sortable {
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,3 @@ export function getTxtFiles(): TxtFile[] {
|
||||||
return sortByPinnedThenDate(files);
|
return sortByPinnedThenDate(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTxtFileNames(): string[] {
|
|
||||||
const txtDir = getTxtDir();
|
|
||||||
if (!fs.existsSync(txtDir)) return [];
|
|
||||||
|
|
||||||
return fs.readdirSync(txtDir).filter(file => file.endsWith('.txt'));
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
import type { APIContext } from 'astro';
|
import type { APIContext } from 'astro';
|
||||||
import { getSlug } from '../lib/md';
|
import { getSlug } from '../lib/md';
|
||||||
import { getTxtFileNames } from '../lib/txt';
|
import { getTxtFiles } from '../lib/txt';
|
||||||
import { SUBDOMAINS } from '../lib/consts';
|
import { SUBDOMAINS } from '../lib/consts';
|
||||||
|
|
||||||
export async function GET(context: APIContext) {
|
export async function GET(context: APIContext) {
|
||||||
const site = context.site?.origin ?? 'https://wynne.rs';
|
const site = context.site?.origin ?? 'https://wynne.rs';
|
||||||
const posts = await getCollection('md');
|
const posts = await getCollection('md');
|
||||||
const txtFiles = getTxtFileNames();
|
const txtFiles = getTxtFiles().map(f => f.name);
|
||||||
|
|
||||||
const urls = [
|
const urls = [
|
||||||
'/',
|
'/',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue