Compare commits
2 commits
30cdde0fc2
...
41e1a4abee
Author | SHA1 | Date | |
---|---|---|---|
|
41e1a4abee | ||
|
c57e214020 |
4 changed files with 2357 additions and 24 deletions
|
@ -22,6 +22,7 @@
|
|||
},
|
||||
"packageManager": "pnpm@10.7.1+sha512.2d92c86b7928dc8284f53494fb4201f983da65f0fb4f0d40baafa5cf628fa31dae3e5968f12466f17df7e97310e30f343a648baea1b9b350685dafafffdf5808",
|
||||
"devDependencies": {
|
||||
"@azure/static-web-apps-cli": "^2.0.6",
|
||||
"@types/node": "^22.15.3"
|
||||
}
|
||||
}
|
||||
|
|
2349
pnpm-lock.yaml
generated
2349
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
17
src/pages/twtxt.txt.js
Normal file
17
src/pages/twtxt.txt.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function GET(context) {
|
||||
const posts = await getCollection('posts');
|
||||
// Sort posts by date (newest first)
|
||||
posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
|
||||
|
||||
const twtxt = posts.map(post => (
|
||||
`${new Date(post.data.pubDate).toISOString()}\t${post.data.title} ${context.site}post/${post.slug}`
|
||||
)).join('\n');
|
||||
|
||||
return new Response(twtxt, {
|
||||
headers: {
|
||||
'Content-Type': 'text/plain'
|
||||
}
|
||||
});
|
||||
}
|
14
swa-cli.config.json
Normal file
14
swa-cli.config.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
|
||||
"configurations": {
|
||||
"mercury": {
|
||||
"appLocation": ".",
|
||||
"outputLocation": "dist",
|
||||
"appBuildCommand": "pnpm run build",
|
||||
"run": "pnpm run dev",
|
||||
"appDevserverUrl": "http://localhost:4321",
|
||||
"appName": "mercury",
|
||||
"resourceGroup": "mercury-rg"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue