Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdan/notes
Turn your Notion database into a deck of cards
https://github.com/jdan/notes
notion notion-api
Last synced: about 2 months ago
JSON representation
Turn your Notion database into a deck of cards
- Host: GitHub
- URL: https://github.com/jdan/notes
- Owner: jdan
- License: mit
- Created: 2021-09-12T17:39:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-04T22:41:06.000Z (8 months ago)
- Last Synced: 2024-05-04T23:26:28.847Z (8 months ago)
- Topics: notion, notion-api
- Language: JavaScript
- Homepage:
- Size: 1010 KB
- Stars: 53
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## cards
Turn a [Notion](https://notion.so) database into a deck of cards. @jdan uses this to power [notes.jordanscales.com](https://notes.jordanscales.com).
### usage
As a heads up, this barely works at all. It may not handle HTML escaping correctly. Do not run on untrusted input.
1. [Create a new Notion integration](https://developers.notion.com/docs/getting-started#step-1-create-an-integration)
1. Create a new database and note it's ID from the address bar- `https://www.notion.so/[username]/[your database ID, copy this!]?v=[ignore this]`
- Add a column called "Filename" to set the output filename for a card. This is required for an `index.html`.1. [Share that database with your new integration](https://developers.notion.com/docs/getting-started#step-2-share-a-database-with-your-integration)
1. Run the script```sh
git clone https://github.com/jdan/cards.git
npm i
NOTION_SECRET=[your token here] NOTION_DATABASE_ID=[your id here] TWITTER_HANDLE=yourHandle node index.js
npx serve build # build/ contains everything you need
# localhost:5000 now shows your cards
```### config
Configuration is provided via environment variables, a [`.env` file, or a config file in the `.env` format](https://github.com/motdotla/dotenv#what-rules-does-the-parsing-engine-follow). To specify a config file, set the `CONFIG=path/to/your/file.env` env var. Here's an example:
```shell
# recipes.env
TWITTER_HANDLE=jitl
OG_IMAGE=https://jake.tl/images/jake-pleasant.jpg
BASE_URL=/recipes
NOTION_SECRET=secret_XXXXXXX
NOTION_DATABASE_ID=a3aa29a6b2f242d1b4cf86fb578a5eea
```Then to use the config, run:
```shell
CONFIG=./recipes.env node index.js
```Take a look at the top 100 lines or so of index.js to see what env vars are available.
### developing
If you're working on improving this software, consider using `npm run watch`,
which will re-build your site whenever any of this source code changes.```shell
CONFIG=./recipes.env npm run watch
```