diff --git a/notes/.obsidian/workspace.json b/notes/.obsidian/workspace.json index 996dd7f..b61fa3d 100644 --- a/notes/.obsidian/workspace.json +++ b/notes/.obsidian/workspace.json @@ -25,7 +25,7 @@ "state": { "type": "markdown", "state": { - "file": "posts/How to perform geoqueries on Firestore (somewhat) efficiently.md", + "file": "readme.md", "mode": "source", "source": false } @@ -98,7 +98,7 @@ "state": { "type": "backlink", "state": { - "file": "posts/How to perform geoqueries on Firestore (somewhat) efficiently.md", + "file": "readme.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -115,7 +115,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "posts/How to perform geoqueries on Firestore (somewhat) efficiently.md", + "file": "readme.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -138,7 +138,7 @@ "state": { "type": "outline", "state": { - "file": "posts/How to perform geoqueries on Firestore (somewhat) efficiently.md" + "file": "readme.md" } } } @@ -161,12 +161,12 @@ }, "active": "1365a4023b87afb4", "lastOpenFiles": [ - "posts/DevRel Funnel.md", + "books/_readme.md", + "posts/_readme.md", "posts/How to perform geoqueries on Firestore (somewhat) efficiently.md", + "posts/DevRel Funnel.md", "readme.md", "Welcome.md", - "books/_readme.md", - "posts/_readme.md", "posts/Untitled.md", "books/Chip War - Chris Miller.md", "books/The Rule of Threes - Jeffery Deaver.md", diff --git a/notes/books/_readme.md b/notes/books/_readme.md index a873660..2103f82 100644 --- a/notes/books/_readme.md +++ b/notes/books/_readme.md @@ -1 +1 @@ -I'm a voracious reader of books and articles. I track all my reading on [GoodReads](https://www.goodreads.com/user/show/24654655) and have been writing short reviews for a few years now, which I'll share here. \ No newline at end of file +I'm a voracious reader of books and articles, and write blurbs about that. I track all my reading on [GoodReads](https://www.goodreads.com/user/show/24654655) and have been writing short reviews for a few years now, which I'll share here. \ No newline at end of file diff --git a/notes/posts/_readme.md b/notes/posts/_readme.md index 32bf706..ed0e0dd 100644 --- a/notes/posts/_readme.md +++ b/notes/posts/_readme.md @@ -1 +1,3 @@ -I write a lot, and sometimes post it here. \ No newline at end of file +I write a lot, and sometimes post it here. + +From February until August 2014 I wrote about many topics on [The Puf Principle](http://frank.vanpuffelen.net/). Most of my public writing can be found in Stack Overflow [questions](https://stackoverflow.com/users/209103/frank-van-puffelen?tab=questions) and [answers](https://stackoverflow.com/users/209103/frank-van-puffelen?tab=answers); really... **do** check them out as there's bound to be **something** useful in there. \ No newline at end of file diff --git a/src/components/Notes.astro b/src/components/Notes.astro index 0d5bfa9..27c192b 100644 --- a/src/components/Notes.astro +++ b/src/components/Notes.astro @@ -27,7 +27,7 @@ export function getPubDateForNote(note) { return ""; // What should the default be here? } -export async function getNotes(options?: { includeSkip?: boolean }) { +export async function getNotes(options?: { keepIf?: (note: any) => boolean }) { // Get all notes recursively from the notes directory const notes = await Astro.glob("../../notes/**/*.md"); @@ -58,6 +58,11 @@ export async function getNotes(options?: { includeSkip?: boolean }) { return !isDraft; }); + // Remove by custom filter + if (options?.keepIf) { + results = results.filter(options.keepIf); + } + // console.log("getNotes", results) return results; } diff --git a/src/layouts/IndexPage.astro b/src/layouts/IndexPage.astro index ab57aff..d01a2c1 100644 --- a/src/layouts/IndexPage.astro +++ b/src/layouts/IndexPage.astro @@ -5,7 +5,7 @@ import Header from '../components/Header.astro'; import Footer from '../components/Footer.astro'; import FormattedDate from '../components/FormattedDate.astro'; import path from "path"; -import { notesPath, getSlugForNote, getTypeForNote } from '../components/Notes.astro'; +import { notesPath, getSlugForNote, getTypeForNote, getNotes } from '../components/Notes.astro'; console.log("IndexPage.astro: Astro.props=", Astro.props) @@ -16,6 +16,8 @@ const type = slug.substring(0, slug.indexOf("/")) // const name = slug.substring(type.length+1) title = type +const notes = await getNotes({ keepIf: (note) => note.params.type === type && !/readme.md$/.test(note.props.file) }); + console.log(slug, type, title) --- @@ -73,9 +75,19 @@ console.log(slug, type, title)

{title}

-
+
+
+
+
There are {notes.length} {type}:
+
    + {notes.map((note) => ( +
  1. {note.props.frontmatter.title} ({note.params.pubDate})
  2. + ))} +
+
+
{
diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index abb185d..b6cf28a 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -2,7 +2,7 @@ import { type CollectionEntry, getCollection } from 'astro:content'; import BlogPost from '../layouts/BlogPost.astro'; import IndexPage from '../layouts/IndexPage.astro'; -import { getNotes, getPubDateForNote } from '../components/Notes.astro'; +import { getNotes, getPubDateForNote, getTypeForNote } from '../components/Notes.astro'; import type { MarkdownInstance } from "astro"; export async function getStaticPaths() { @@ -15,18 +15,20 @@ const { Content } = post; const pubDate = getPubDateForNote(post) const isReadme = (/readme.md$/.test(post.file)) +const type = getTypeForNote(post) console.log("Rendering ", post.file, " with pubDate ", pubDate, " and isReadme ", isReadme, " to ", JSON.stringify(post)) // TODO: -// * [ ] Show all notes of type on index page for that type -// * [ ] Link index page for type back to home page -// * [ ] Show current index page (and detail page?) as a "breakcrumb" in the header +// * [ ] Link note page for type back to type index page +// * [ ] Show current index page as "breakcrumb" in the header for note-detail page // * [ ] Assign layout based on note type // * [ ] Determine pubDate based on note type, instead of hard-coding them (in Notes.astro) -// * [ ] Show one-line readme on main index.html +// * [ ] Show first sentence of readme on home page // * [ ] Limit number of notes on homepage // * [ ] group notes on category page on date (month) or whatever else makes sense +// * [x] Link index page for type back to home page (that was always the case) +// * [x] Show all notes of type on index page for that type (done: in Notes.astro and IndexPage.astro) // * [x] Generate additional nodes/paths for category pages // * [x] Show readme on pages // * [x] Skip notes whose pubDate is in the future