0.7.2 • Published 10 months ago

motionlink-cli v0.7.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Motionlink-cli

Use Notion as a Content Management System for personal websites, portfolios, blogs, business homepages, and other kinds of static websites.

Plain Markdown Support

Supported Notion Blocks

  • Paragraph blocks
  • Heading one blocks
  • Heading two blocks
  • Heading three blocks
  • Callout blocks
  • Quote blocks
  • Bulleted list items
  • Numbered list item blocks
  • TODO blocks
  • Toggle blocks
  • Code blocks
  • Child page blocks (Adds link to page)
  • Child database blocks (Adds link to database)
  • Embed blocks (Adds link to resource)
  • Image blocks
  • Video blocks (Adds link to video)
  • File blocks (Adds link to file)
  • PDF blocks (Adds link to pdf)
  • Bookmark blocks (Adds link to bookmark)
  • Equation blocks
  • Divider blocks
  • Table of contents blocks
  • Link preview blocks
  • Template blocks
  • Link to page blocks
  • Synced Block blocks
  • Table blocks
  • Table row blocks

Less likely to be supported blocks

  • Column List and Column blocks
  • Breadcrumb blocks

Install

npm install motionlink-cli --save-dev

Getting started with Motionlink

See the Getting started guide.

Available commands

Motionlink vars

Motionlink works by connecting a databas in your Notion workspace to a Github repo. This connection is called a link. One link connects one Notion database to one Github repo. Different links are allowed to point to the same Github repo. Each link has an access key that can be used to access the linked Notion database through the Notion API.

It is the access keys that this CLI tool uses to access your databases to feed content into your static website. Access keys, however, are alphanumeric strings that can be hard for a human to remember. A pair string of DB_NAME=ACCESS_KEY is referred to as a Motionlink var. A Motionlink var maps an alias name to a link access key for easy referencing from config files. Motionlink vars can be combined into one string by simply separating them with spaces: DB_NAME1=ACCESS_KEY1 DB_NAME2=ACCESS_KEY2 ....

Motionlink Vars can be generated from the Console App by creating a new Link. Selecting a link on the console should enable a "Show Args" button at the top of the page that, when clicked, shows the MotionLink vars that can be used with this CLI to access that link. You can select multiple links before clicking "Show Args" to allow the CLI access to all the databases the links connect.

An easier way of creating links, however is via the connect command (See below).

Once you have your Motionlink config file, you can use the CLI with the following commands.

Classic build

The classic build command lets you run your config file by passing your Motionlink vars string on the command line. If working with one link, this command might not be an issue, but for very long Motionlink vars strings it can be hard to read.

npx motionlink {MOTIONLINK_VARS}

Replace {MOTIONLINK_VARS} with the Motionlink vars.

Build

The build command runs your config file with the Motionlink vars found in the your .mlvars file.

npx motionlink build

Say your .mlvars file contains the text:

posts=31a49b161d214258bd3c43e83c26f64a bloggerInfo=d2cb2fab93eb49d1bcb02ab4e5f8f4ab

Then the above command is equivalent the classic build:

npx motionlink posts=31a49b161d214258bd3c43e83c26f64a bloggerInfo=d2cb2fab93eb49d1bcb02ab4e5f8f4ab

Connect

The connect command is a complement to the build command in the sense that it automatically create links for your project from your Notion dashboard and creates the .mlvars file for you. This command makes setting up links a lot easier. This command can also setup Netlify hosting for your project which means all you will need to do is push your code and start publishing from Notion.

npx motionlink connect

You will be promted for the remote URL to your Github repository as well as whether or not you want to setup Netlify hosting for your project. After collecting all the necessary information, this command will make an OAuth-like request to the Motionlink Console where you will be required to sign into Github, Notion, and optionally Netlify.

Netlify OAuth can sometimes not redirect back to the application if you were logged out. If this happens, simply follow the printent link again. It always redirects when you are logged in already.

This command expects your Notion dashboard to be setup like a Motionlink Website dashboard. That is, the root page of the dashboard has the following properties:

  1. The title of the root page should contain the git remote URL for your website
  2. And it needs to list the databases (collections) below the callout block

An example of such a dashboard can be seen here.

If you selected to deploy to Netlify, this command will push Netlify deploy secrets as well as Motionlink vars to your Github repo and also add a deploy.yml workflow file to your project. This workflow file uses the secrets to build and deploy the website upon a push or when Motionlink reports a publish event by tagging the repo.

For more complicated projects, like those that use Jekyll or Hugo, you may need to update the workflow file to install required binaries before running the build command. If you do not plan to host with Netlify, simply opt out of Netlify hosting and setup your own workflow(s).

Contributing

Feel free to contribute, drop issues and rquest features! We also have a our discussions tab enabled. Feel free to start conversations.

Author

Batandwa Mgutsi

0.7.2

10 months ago

0.7.1

10 months ago

0.7.0

10 months ago

0.6.0

10 months ago

0.5.9

1 year ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.4

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.4.5

2 years ago

0.5.3

2 years ago

0.4.4

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.0-alpha.4

2 years ago

0.4.0-alpha.3

2 years ago

0.4.0-alpha.2

2 years ago

0.4.0-alpha.1

2 years ago

0.4.0-alpha.0

2 years ago

0.3.0-alpha-0

2 years ago

0.2.1

2 years ago

0.3.0-alpha.2

2 years ago

0.4.1

2 years ago

0.3.2

2 years ago

0.3.1-alpha.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.1-alpha.2

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.0-alpha.1

2 years ago

0.2.0

3 years ago

0.1.17

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago