Skip to content

Conversation

@riastrad
Copy link
Owner

Closes #270

Basic idea here is that instead of having to cram html into a page property that I write/edit very clumsily. I can just type a review on a given book's associated page and then the action will pull all of the data and parse it into the correct html output.

@riastrad
Copy link
Owner Author

Pausing the work briefly because I'm running this too often locally and getting ratelimited by Notion (whoops). This highlights two problems: page pagination is killing me & having to hit the blocks endpoint as well for every review each time the job is run might lead to increased rate limiting.

@riastrad
Copy link
Owner Author

As of ce75ad2, this PR will do the absolute basics to pull a review from a page if the property is not present. If I'd like to preserve any text styling (bold, italics, &c.) then I'll need to add a bit more finesse.

Additionally, I'll need to preserve the use of blockquotes (which are used in a small sample of existing reviews) and I haven't dug into what that will take just yet.

For these reasons, I'm going to leave this as a draft until I have time to come back and give it some finishing touches.

@riastrad
Copy link
Owner Author

Was curious about blockquotes and couldn't help myself. Looks like they're a unique object type:

{
    object: 'block',
    id: '2940ce2f-0a7e-805a-88ad-e8d80466cb1a',
    parent: {
      type: 'page_id',
      page_id: '26d0ce2f-0a7e-80f8-823e-eca5fe8a63ce'
    },
    created_time: '2025-10-22T08:49:00.000Z',
    last_edited_time: '2025-10-22T08:49:00.000Z',
    created_by: { object: 'user', id: '1e4d872b-594c-81bf-baed-0002aa4eb4f1' },
    last_edited_by: { object: 'user', id: '1e4d872b-594c-81bf-baed-0002aa4eb4f1' },
    has_children: false,
    archived: false,
    in_trash: false,
    type: 'quote',
    quote: {
      rich_text: [
        {
          type: 'text',
          text: { content: 'What about a blockquote?', link: null },
          annotations: {
            bold: false,
            italic: false,
            strikethrough: false,
            underline: false,
            code: false,
            color: 'default'
          },
          plain_text: 'What about a blockquote?',
          href: null
        }
      ],
      color: 'default'
    }
  }

@riastrad
Copy link
Owner Author

Might come in handy later: https://developers.notion.com/reference/request-limits

image

@riastrad
Copy link
Owner Author

riastrad commented Nov 6, 2025

Thinking this over & I want to add a new boolean parameter called has_review_page that can be checked in order to pull the review content. This solves the problem of being rate-limited because I'm hitting the endpoint for non-existent content.

It also will allow me to live in the intermediate state of having review data in two different places a bit more gracefully.

@riastrad
Copy link
Owner Author

With 6d3848a this should now better support pulling review content from child page blocks in Notion. It also supports every style annotation I imagine that I'll use.

On the data side I've added a reviewed boolean attribute to my have-read data that I can use to indicate that a given page has a review that's ready to be published on the site. This is actually a nice little upgrade since previously any data that was present when the job ran would be published (mostly harmless, but also could have been embarrassing if I was actively editing or brainstorming a review at the wrong part of the day).

My plan is to publish this & have the code running, then I can update the pages in Notion at my own leisure.

Once all of my reviews have been moved to the child pages & I no longer have handwritten html directly in an attribute, I'll go ahead and deprecate the review field in Notion.

@riastrad riastrad marked this pull request as ready for review November 18, 2025 11:28
@riastrad riastrad merged commit c354730 into main Nov 18, 2025
2 checks passed
@riastrad riastrad deleted the blockhead-reviews branch November 18, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enhancement] pull book reviews from Notion page content, not property

2 participants