A .NET Console App to export your Notion pages as markdown and publish them to your Hugo static web site.
Before getting started, you need to prepare some parameters:
- Notion API Token: configure a new integration in order to generate a new API key (learn more)
- Database ID: get the ID for the database which you want to export the page
- Page Status: specify which pages to export with a given page status
The program is optimized to work with a minimum set of properties from your Notion pages (the Notion property type is mentioned in parenthesis):
- (Text) PostURL: the URL of your post (also used as the folder name),
- (Title) Title: the title of your post,
- (Select) Category: the main category of your post,
- (Select) Subcategory: the subcategory of your post,
- (Integer) Index: the index of your post in a specific serie (especially useful when several posts have the same PublishDate),
- (Date) PublishDate: the date when to publish your post,
- (Select) Language: the language of post ("French" or "English"),
- (Text) Description: summary of your post,
- (Multi-select) Tags: a list of tags associated to your post,
- (Status) Status: the status of your page.
You can either export all pages from a DataBase matching with a specific status...
dotnet run "NotionApiToken={YOUR_API_KEY}" "DatabaseId={YOUR_DATABASE_ID}" "Status={YOUR_PAGE_STATUS}"
...or only export a subset of pages.
dotnet run "NotionApiToken={YOUR_API_KEY}" "PageIds={{PAGE_ID_1};{PAGE_ID_2}}"
Note: you can also specify the output folder with adding the parameter "TmpFolder={YOUR_FOLDER_PATH}"
to your command.