Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database support to create blog pages from Notion tables #11

Open
conradlin opened this issue Apr 30, 2022 · 2 comments
Open

Database support to create blog pages from Notion tables #11

conradlin opened this issue Apr 30, 2022 · 2 comments

Comments

@conradlin
Copy link

Describe the solution you'd like
I'd love to work together with you to develop database support so we can iterate on posts and create the custom CMS page for each.

Describe alternatives you've considered
Previously, I was using Gatsby <> Notion integration but its since been depreciated. Your solution is great but doesn't allow me to add a custom blog template for blog pages, and also specify slug, page descriptions, etc.

Additional context
I hosted a livestream today where I built with your tool live and would love to continue developing more!

@conradlin conradlin changed the title Database support to create custom CMS pages Database support to create blog pages from Notion tables Apr 30, 2022
@zernonia
Copy link
Owner

zernonia commented May 2, 2022

Hi @conradlin
The Collection view (aka Database) is quite challenging, PR is most welcomed ya!

If you really want a quick solution to retrieve Database data, you can use Official Notion API.

@hacknug
Copy link
Contributor

hacknug commented May 2, 2022

Describe alternatives you've considered
Previously, I was using Gatsby <> Notion integration but its since been depreciated. Your solution is great but doesn't allow me to add a custom blog template for blog pages, and also specify slug, page descriptions, etc.

You can currently use $notion.getPageTable() to get the entries of a database. Note this will not fetch the content for each individual entry, only its properties (if you need the content, you'll need to use $notion.getPageBlocks()).

One of the issues I encountered when building my project was that I needed to get schema of a database to be able to implement a way to filter my posts. I could have used the values inside each post but I wanted to also show categories that don't have any post attached.

This led me to fork notion-api-worker to apply a small change. In my fork, getPageTable() returns both the rows data (just like the original does) as well as the schema definition. You can try my worker in case you also need that data to build your site: https://notion.incoming.workers.dev/v1 (getPageBlocks and getPageTable accept a second parameter with a custom URL for the worker).


If you want to be able to manually sort your database entries without relying on a property of the table, this is your only option. Notion's public API doesn't support database's views, so using the private API is the only way I've found to be able to drag'n'drop entries to sort them any way I want.

I reached out to support asking if/when will they add support for Views and I got the same response I got for years when asking about the status of the public API, so I wouldn't count of having it any time soon. They're a small team and usually take their time to build everything the way they consider best.

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

No branches or pull requests

3 participants