-
+
diff --git a/src/content/appendices/01-piano-key-frequencies.mdx b/src/content/appendices/01-piano-key-frequencies.mdx
new file mode 100644
index 0000000..46eb68f
--- /dev/null
+++ b/src/content/appendices/01-piano-key-frequencies.mdx
@@ -0,0 +1,7 @@
+---
+title: Piano Key Frequencies
+---
+
+import { FrequenciesForm } from '../../components/FrequenciesForm';
+
+
diff --git a/src/pages/ch01-introduction.mdx b/src/content/chapters/01-introduction.mdx
similarity index 100%
rename from src/pages/ch01-introduction.mdx
rename to src/content/chapters/01-introduction.mdx
diff --git a/src/pages/ch02-speed.mdx b/src/content/chapters/02-speed.mdx
similarity index 100%
rename from src/pages/ch02-speed.mdx
rename to src/content/chapters/02-speed.mdx
diff --git a/src/pages/ch03-analysis.mdx b/src/content/chapters/03-analysis.mdx
similarity index 100%
rename from src/pages/ch03-analysis.mdx
rename to src/content/chapters/03-analysis.mdx
diff --git a/src/pages/ch04-sound-projection.mdx b/src/content/chapters/04-sound-projection.mdx
similarity index 100%
rename from src/pages/ch04-sound-projection.mdx
rename to src/content/chapters/04-sound-projection.mdx
diff --git a/src/content/chapters/05-limits.mdx b/src/content/chapters/05-limits.mdx
new file mode 100644
index 0000000..9da1242
--- /dev/null
+++ b/src/content/chapters/05-limits.mdx
@@ -0,0 +1,3 @@
+---
+title: Limits
+---
diff --git a/src/content/chapters/06-overcoming-doubts.mdx b/src/content/chapters/06-overcoming-doubts.mdx
new file mode 100644
index 0000000..6fbbc01
--- /dev/null
+++ b/src/content/chapters/06-overcoming-doubts.mdx
@@ -0,0 +1,3 @@
+---
+title: Overcoming Doubts
+---
diff --git a/src/content/chapters/07-fingering.mdx b/src/content/chapters/07-fingering.mdx
new file mode 100644
index 0000000..8d023a2
--- /dev/null
+++ b/src/content/chapters/07-fingering.mdx
@@ -0,0 +1,3 @@
+---
+title: Fingering
+---
diff --git a/src/content/chapters/08-pulse.mdx b/src/content/chapters/08-pulse.mdx
new file mode 100644
index 0000000..576d1ef
--- /dev/null
+++ b/src/content/chapters/08-pulse.mdx
@@ -0,0 +1,3 @@
+---
+title: Pulse
+---
diff --git a/src/content/chapters/09-sensation.mdx b/src/content/chapters/09-sensation.mdx
new file mode 100644
index 0000000..edfab22
--- /dev/null
+++ b/src/content/chapters/09-sensation.mdx
@@ -0,0 +1,3 @@
+---
+title: Sensation
+---
diff --git a/src/content/chapters/10-autopilot.mdx b/src/content/chapters/10-autopilot.mdx
new file mode 100644
index 0000000..c4d9e11
--- /dev/null
+++ b/src/content/chapters/10-autopilot.mdx
@@ -0,0 +1,3 @@
+---
+title: Autopilot
+---
diff --git a/src/pages/ch11-musicality.mdx b/src/content/chapters/11-musicality.mdx
similarity index 100%
rename from src/pages/ch11-musicality.mdx
rename to src/content/chapters/11-musicality.mdx
diff --git a/src/content/chapters/12-the-musician.mdx b/src/content/chapters/12-the-musician.mdx
new file mode 100644
index 0000000..53fd26b
--- /dev/null
+++ b/src/content/chapters/12-the-musician.mdx
@@ -0,0 +1,3 @@
+---
+title: The Musician
+---
diff --git a/src/content/chapters/13-ornaments.mdx b/src/content/chapters/13-ornaments.mdx
new file mode 100644
index 0000000..fa67953
--- /dev/null
+++ b/src/content/chapters/13-ornaments.mdx
@@ -0,0 +1,3 @@
+---
+title: Ornaments
+---
diff --git a/src/content/chapters/14-rests.mdx b/src/content/chapters/14-rests.mdx
new file mode 100644
index 0000000..c2345ce
--- /dev/null
+++ b/src/content/chapters/14-rests.mdx
@@ -0,0 +1,3 @@
+---
+title: Rests
+---
diff --git a/src/content/chapters/15-gestures.mdx b/src/content/chapters/15-gestures.mdx
new file mode 100644
index 0000000..6b613f5
--- /dev/null
+++ b/src/content/chapters/15-gestures.mdx
@@ -0,0 +1,3 @@
+---
+title: Gestures
+---
diff --git a/src/content/chapters/16-articulation.mdx b/src/content/chapters/16-articulation.mdx
new file mode 100644
index 0000000..408c81e
--- /dev/null
+++ b/src/content/chapters/16-articulation.mdx
@@ -0,0 +1,3 @@
+---
+title: Articulation
+---
diff --git a/src/content/chapters/17-expression.mdx b/src/content/chapters/17-expression.mdx
new file mode 100644
index 0000000..ddff86c
--- /dev/null
+++ b/src/content/chapters/17-expression.mdx
@@ -0,0 +1,3 @@
+---
+title: Expression
+---
diff --git a/src/content/chapters/18-mistakes.mdx b/src/content/chapters/18-mistakes.mdx
new file mode 100644
index 0000000..4cc2005
--- /dev/null
+++ b/src/content/chapters/18-mistakes.mdx
@@ -0,0 +1,3 @@
+---
+title: Mistakes
+---
diff --git a/src/content/chapters/19-performance.mdx b/src/content/chapters/19-performance.mdx
new file mode 100644
index 0000000..609b952
--- /dev/null
+++ b/src/content/chapters/19-performance.mdx
@@ -0,0 +1,3 @@
+---
+title: Performance
+---
diff --git a/src/pages/ch20-trills.mdx b/src/content/chapters/20-trills.mdx
similarity index 100%
rename from src/pages/ch20-trills.mdx
rename to src/content/chapters/20-trills.mdx
diff --git a/src/pages/ch21-speed-and-anticipation.mdx b/src/content/chapters/21-speed-and-anticipation.mdx
similarity index 100%
rename from src/pages/ch21-speed-and-anticipation.mdx
rename to src/content/chapters/21-speed-and-anticipation.mdx
diff --git a/src/content/chapters/22-thirds.mdx b/src/content/chapters/22-thirds.mdx
new file mode 100644
index 0000000..43f7bea
--- /dev/null
+++ b/src/content/chapters/22-thirds.mdx
@@ -0,0 +1,3 @@
+---
+title: Thirds
+---
diff --git a/src/content/config.ts b/src/content/config.ts
new file mode 100644
index 0000000..c58d39e
--- /dev/null
+++ b/src/content/config.ts
@@ -0,0 +1,28 @@
+import { z, defineCollection } from 'astro:content';
+
+const specialCollection = defineCollection({
+ type: 'content',
+ schema: z.object({
+ title: z.string(),
+ }),
+});
+
+const chaptersCollection = defineCollection({
+ type: 'content',
+ schema: z.object({
+ title: z.string(),
+ }),
+});
+
+const appendicesCollection = defineCollection({
+ type: 'content',
+ schema: z.object({
+ title: z.string(),
+ }),
+});
+
+export const collections = {
+ 'special': specialCollection,
+ 'chapters': chaptersCollection,
+ 'appendices': appendicesCollection,
+};
diff --git a/src/content/layouts/Appendix.astro b/src/content/layouts/Appendix.astro
new file mode 100644
index 0000000..d3676af
--- /dev/null
+++ b/src/content/layouts/Appendix.astro
@@ -0,0 +1,186 @@
+---
+const { title, titlePrefix } = Astro.props.frontmatter || Astro.props;
+---
+
+
+
+
+
+
+
+
{title}
+
+
+
+
+
+
diff --git a/src/layouts/Cover.astro b/src/content/layouts/Cover.astro
similarity index 100%
rename from src/layouts/Cover.astro
rename to src/content/layouts/Cover.astro
diff --git a/src/layouts/Default.astro b/src/content/layouts/Default.astro
similarity index 96%
rename from src/layouts/Default.astro
rename to src/content/layouts/Default.astro
index 8abe3b0..8f5aeb7 100644
--- a/src/layouts/Default.astro
+++ b/src/content/layouts/Default.astro
@@ -54,6 +54,10 @@ const { title } = Astro.props.frontmatter || Astro.props;
@apply mb-16;
}
+ table {
+ caption-side: bottom;
+ }
+
@media only screen {
html {
@apply text-gray-800;
@@ -108,6 +112,10 @@ const { title } = Astro.props.frontmatter || Astro.props;
figcaption {
@apply text-sm;
}
+
+ .print-hidden {
+ display: none;
+ }
}
@media only screen and (prefers-color-scheme: dark) {
diff --git a/src/pages/foreword.mdx b/src/content/special/foreword.mdx
similarity index 100%
rename from src/pages/foreword.mdx
rename to src/content/special/foreword.mdx
diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro
new file mode 100644
index 0000000..247e140
--- /dev/null
+++ b/src/pages/[...slug].astro
@@ -0,0 +1,18 @@
+---
+import { getCollection } from 'astro:content';
+import Default from '../content/layouts/Default.astro';
+
+export const getStaticPaths = async () => {
+ const entries = await getCollection('special');
+ return entries.map(entry => ({
+ params: { slug: entry.slug }, props: { entry },
+ }));
+}
+
+const { entry } = Astro.props;
+const { Content } = await entry.render();
+---
+
+
+
+
diff --git a/src/pages/appendices/[...slug].astro b/src/pages/appendices/[...slug].astro
new file mode 100644
index 0000000..dadfa43
--- /dev/null
+++ b/src/pages/appendices/[...slug].astro
@@ -0,0 +1,19 @@
+---
+import { getCollection } from 'astro:content';
+import Layout from '../../content/layouts/Appendix.astro';
+
+export const getStaticPaths = async () => {
+ const entries = await getCollection('appendices');
+ return entries.map(entry => ({
+ params: { slug: entry.slug }, props: { entry },
+ }));
+}
+
+const { entry } = Astro.props;
+const { Content } = await entry.render();
+const titlePrefix = String.fromCharCode(parseInt(entry.slug) - 1 + 65);
+---
+
+
+
+
diff --git a/src/pages/appendix01-piano-key-frequencies.mdx b/src/pages/appendix01-piano-key-frequencies.mdx
deleted file mode 100644
index 441b484..0000000
--- a/src/pages/appendix01-piano-key-frequencies.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: Piano Key Frequencies
-layout: ../layouts/Default.astro
----
-
-import { FrequenciesForm } from '../components/FrequenciesForm';
-
-
diff --git a/src/pages/ch05-limits.mdx b/src/pages/ch05-limits.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch06-overcoming-doubts.mdx b/src/pages/ch06-overcoming-doubts.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch07-fingering.mdx b/src/pages/ch07-fingering.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch08-pulse.mdx b/src/pages/ch08-pulse.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch09-sensation.mdx b/src/pages/ch09-sensation.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch10-autopilot.mdx b/src/pages/ch10-autopilot.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch12-the-musician.mdx b/src/pages/ch12-the-musician.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch13-ornaments.mdx b/src/pages/ch13-ornaments.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch14-rests.mdx b/src/pages/ch14-rests.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch15-gestures.mdx b/src/pages/ch15-gestures.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch16-articulation.mdx b/src/pages/ch16-articulation.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch17-expression.mdx b/src/pages/ch17-expression.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch18-mistakes.mdx b/src/pages/ch18-mistakes.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch19-performance.mdx b/src/pages/ch19-performance.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/ch22-thirds.mdx b/src/pages/ch22-thirds.mdx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/chapters/[...slug].astro b/src/pages/chapters/[...slug].astro
new file mode 100644
index 0000000..9ffc71f
--- /dev/null
+++ b/src/pages/chapters/[...slug].astro
@@ -0,0 +1,18 @@
+---
+import { getCollection } from 'astro:content';
+import Default from '../../content/layouts/Default.astro';
+
+export const getStaticPaths = async () => {
+ const entries = await getCollection('chapters');
+ return entries.map(entry => ({
+ params: { slug: entry.slug }, props: { entry },
+ }));
+}
+
+const { entry } = Astro.props;
+const { Content } = await entry.render();
+---
+
+
+
+
diff --git a/src/pages/index.astro b/src/pages/index.astro
new file mode 100644
index 0000000..3a8092d
--- /dev/null
+++ b/src/pages/index.astro
@@ -0,0 +1,10 @@
+---
+import Default from '../content/layouts/Cover.astro';
+import { title } from '../../patchouli.book.json';
+---
+
+
+
+
+
+
diff --git a/src/pages/index.mdx b/src/pages/index.mdx
deleted file mode 100644
index e2f1a68..0000000
--- a/src/pages/index.mdx
+++ /dev/null
@@ -1,7 +0,0 @@
----
-title: Book Name
----
-
-
-
-
diff --git a/src/pages/toc.astro b/src/pages/toc.astro
index 9e59ec1..e551494 100644
--- a/src/pages/toc.astro
+++ b/src/pages/toc.astro
@@ -1,6 +1,6 @@
---
import { readdir, readFile } from 'node:fs/promises';
-const { default: Default } = await import('../layouts/Default.astro');
+import Default from '../content/layouts/Default.astro';
type Frontmatter = Record
;
@@ -9,7 +9,7 @@ interface PageProps {
}
const title = 'Table of Contents'
-const allPages = await readdir('src/pages');
+const allPages = await readdir('src/content/chapters');
const pages = allPages.filter((p) => (
!p.startsWith('index.')
&& !p.endsWith('.astro')
@@ -18,7 +18,7 @@ const pages = allPages.filter((p) => (
const pagesContentImported = await Promise.all(
pages.map(async (p) => {
- const fileBuffer = await readFile(`src/pages/${p}`);
+ const fileBuffer = await readFile(`src/content/chapters/${p}`);
const file = fileBuffer.toString('utf-8');
const [, frontmatterRaw] = file.split('---');
@@ -39,7 +39,7 @@ const pagesContentImported = await Promise.all(
{pagesContentImported.map(([p, f]) => (
-
-
+
{f.frontmatter.title}