diff --git a/astro.config.js b/astro.config.js index 73fd985..c53ff45 100644 --- a/astro.config.js +++ b/astro.config.js @@ -1,14 +1,19 @@ -import tailwind from '@astrojs/tailwind'; import { defineConfig } from 'astro/config'; -import flattenListItems from 'mdast-flatten-listitem-paragraphs'; +import react from '@astrojs/react'; +import keystatic from '@keystatic/astro'; +import tailwind from '@astrojs/tailwind'; +import flattenListItems from 'mdast-flatten-listitem-paragraphs'; import mdx from '@astrojs/mdx'; +const prod = process.env.NODE_ENV === 'production'; + // https://astro.build/config export default defineConfig({ site: import.meta.env.PROD ? 'https://filipesm.eu' : 'http://localhost:1234', - integrations: [tailwind(), mdx()], + integrations: [tailwind(), mdx(), ...(!prod ? [keystatic(), react()] : [])], markdown: { remarkPlugins: [flattenListItems], }, + output: prod ? 'static' : 'hybrid', }); diff --git a/bun.lockb b/bun.lockb index d36dc0a..f145249 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/keystatic.config.ts b/keystatic.config.ts new file mode 100644 index 0000000..89ac91e --- /dev/null +++ b/keystatic.config.ts @@ -0,0 +1,26 @@ +import { config, fields, collection } from '@keystatic/core'; + +export default config({ + storage: { + kind: 'local', + }, + collections: { + library: collection({ + label: 'Library items', + slugField: 'slug', + path: 'src/content/library/**', + schema: { + slug: fields.slug({ name: { label: 'Slug' } }), + title: fields.text({ + label: 'Title', + validation: { isRequired: true }, + }), + checkedOut: fields.checkbox({ label: 'Checked out?' }), + link: fields.url({ label: 'Link', validation: { isRequired: true } }), + description: fields.text({ label: 'Description', multiline: true }), + date: fields.date({ label: 'Date', validation: { isRequired: true } }), + mainAuthor: fields.text({ label: 'Main author(s)' }), + }, + }), + }, +}); diff --git a/package.json b/package.json index e452db3..583f4bd 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,14 @@ }, "dependencies": { "@astrojs/mdx": "^1.1.5", + "@astrojs/react": "^3.3.0", "@astrojs/rss": "^4.0.5", "@astrojs/tailwind": "^5.0.3", + "@keystatic/astro": "^5.0.0", + "@keystatic/core": "^0.5.11", "astro": "^4.0.6", "mdast-flatten-listitem-paragraphs": "^1.0.0", + "react": "^18.2.0", "sharp": "^0.33.1" }, "devDependencies": {