Papertown syncs you personal markdown blog with blog platforms like dev.to.
Best way to get an overview is to read this blog post: https://christiankohler.net/introducing-papertown
Papertown sync only articles with a masterid in the frontmatter. The masterid helps papertown identify articles.
For every article it compares the content and then:
- if article doesn't exist -> create
- if article hasn't changed -> do nothing
- if article has changed -> update
- DevTo
If the rootfolder is different change it in the config.
- blog-articles
- article one
- index.md
- article two
- index.md
Important: Posts without a masterid are ignored.
---
title: "Sample Blog Post"
masterid: 123
---
---
title: "Sample Blog Post"
masterid: 123
canonical_url: "url to this blog article"
---
---
title: "Sample Blog Post"
masterid: 123
canonical_url: "url to this blog article"
published: false
---
papertown sync --devtoApiKey apikey
Config | Env | Args |
---|---|---|
Root Folder | ROOT_FOLDER | rootFolder |
API Key DevTo | DEVTO_API_KEY | devtoApiKey |
Github URL for images | IMAGE_ROOT_URL_GITHUB | imageRootUrlGithub |
Dry Run | DRY_RUN | dryRun |
papertown sync --devtoApiKey apikey
DEVTO_API_KEY="yourdevtoapikey"
DEVTO_API_KEY="yourdevtoapikey" papertown sync
Use dryRun to not create or update the post and only log what would happen.
Papertown can replace relative images with absolute github urls.
Requirements are:
- Github repo is public
- imageRootUrlGithub is set
Run:
papertown sync
--rootFolder content/posts
--imageRootUrlGithub https://raw.githubusercontent.com/ChristianKohler/Homepage/master
and the url in the file (content/posts/first-post/index.html)
./images/hero.png
will be replace with:
https://raw.githubusercontent.com/ChristianKohler/Homepage/master/content/posts/first-post/images/hero.png
Can be a relative image, papertown will resolve it.
cover_image: direct_url_to_image.jpg
Papertown can be used within your node script.
const { sync } = require("papertown");
const config = {
rootFolder: "my-root-folder",
devtoApiKey: "my-key",
imageRootUrlGithub: "",
dryRun: false,
};
await sync(config);