npm package: @akiboi/notion-sync-astro
Description: This package integrates Notion with Astro. It automatically syncs articles from Notion to Astro-compatible folders, converting them to MDX format and downloading any referenced images to a local directory.
Author: akibo.I
Latest version: 0.0.8
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

<h1 align="center">Welcome to @akiboi/notion-sync-astro 👋</h1>
<p>
  <img alt="Version" src="https://img.shields.io/badge/version-0.0.7-blue.svg?cacheSeconds=2592000" />
  <a href="#" target="_blank">
    <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
  </a>
</p>

## Notion to Astro Sync: Automate Your Blog Workflow

**Overview**

This package seamlessly synchronizes articles from Notion to your Astro blog. It converts articles to MDX format and downloads referenced images locally.

**Key Features:**

- Automatic synchronization from Notion database
- Article conversion to MDX format
- Local image download for articles
- Draft and publish workflow support
- Extensive configuration options

**Getting Started:**

1. **Prepare Notion Database:**

Create a database with the following columns:

- ID: Unique key (auto-generated)
- Title: Article title
- Hero Image: Main image for the article
- Menu: Article category
- Slug: Article URL
- Description: Article summary
- Tags: Article tags
- Author: Article author
- Status: Draft, Scheduled, Published
- Published Date: Article publish date (auto-set)
- Updated Date: Article update date (auto-set)
- Created By: Article creator (auto-set)
- Created Date: Article creation date (auto-set)

2. **Package Installation:**

```bash
npm install @akiboi/notion-sync-astro
```

3. **Configuration:**

Configure the following in `index.ts`:

- Notion API key
- Database ID
- Article output directory
- Image output directory
- Other options

4. **Run:**

```bash
   export NOTION_API_KEY="Notion API Key"
   export NOTION_DB_ID="Notion Database ID"
```

example.ts

```javascript
import { NotionSyncAstro } from '@akiboi/notion-sync-astro';

const nsa = new NotionSyncAstro();
nsa.start();
```

5. **Using in Astro:**

Articles are saved in MDX format. Set the title, publish date, update date, hero image, description, tags, and other attributes in the frontmatter.

```markdown
---
title: 'Astro Blog Creation: From Setup to Article Display'
publishedDate: 2024-03-17
updatedDate: 2024-03-20
heroImage: astroBlog01.jpg
description: 'This article provides a detailed explanation of the entire process of creating a blog with Astro, from setup to article display. If you have experience with Nuxt or Gatsby, the transition should be relatively smooth.'
name: akibo.I
tags: [software, astro]
---
```

**Limitations:**

- As a beta release, unexpected termination or errors in the generated articles may occur.
- Only some list formatting is supported for Notion rich_text.
- Large data processing may not be supported.
- Error handling for Notion API is omitted.

**Future Plans:**

- Automatic article update triggered by Notion status change
- Draft article preview functionality
- Automatic deployment to production environment

**Developer:**

akibo.I

🏠 [Homepage](https://www.akiboi.net)

**Additional Notes:**

This package is a useful tool for users who want to streamline their blog management workflow by connecting Notion and Astro. We encourage you to give it a try!

**Change Log:**

- 2023-11-14: Initial release
- 2023-03-24: bug fix