- Complete the template install
- Manually create an article on Dev.to (Create Post buttons in the top right corner)
- Enter a dum title (It will be overridden later)
- Save the article as draft (Save draft button in the let bottom corner)
- Open your console and paste
$('div[data-article-id]').getAttribute('data-article-id')
- Copy/paste the result in a new object in
./dev-to-git.json
- Write your article in the folder you indicate as
relativePathToArticle
- Merge on
master
=> The article will be sync automatically
- Change the header of an unpublished article from
published: false
topublished: true
- Merge on
master
=> The article will be published automatically
/!\ Don't publish your article manually. If you don't change published
to true
the next sync will unpublish your article.
There's a dev-to-git.json
file where you can define an array of blog posts, e.g.
[
{
"id": 12345,
"relativePathToArticle": "./blog-posts/name-of-your-blog-post/name-of-your-blog-post.md"
}
]
This repository is made to edit a blog post. Whether it's published or just a draft, you have to create it on dev.to directly. Unfortunately, dev.to does not display the ID of the blog post on the page. So once it's created, you can open your browser console and paste the following code to retrieve the blog post ID:
$('div[data-article-id]').getAttribute('data-article-id')
A blog post has to have a front matter header. You can find an example in this repository here: https://github.com/maxime1992/dev.to/blob/master/blog-posts/name-of-your-blog-post/name-of-your-blog-post.md
Simple and from there you have control over the following properties: title
, published
, cover_image
, description
, tags
, series
and canonical_url
.
Instead of uploading them manually on dev.to, simply put them within your git repo and within the blog post use a relative link. Here's an example: The following is an image: ![alt text](./assets/image.png 'Title image')
.
If you've got some plugin to preview your markdown from your IDE, the images will be correctly displayed. Then, on CI, right before they're published, the link will be updated to match the raw file.
You can write the code you want to embed in your article in a dedicated file with the right extension. Your IDE will provide you syntax coloration and language specific help. Prettier will format the code according to its extension.
-
Add a code block to your article with the path of a file
```ts // code/demo-code.ts ```
-
Write your code in the file
-
Run
yarn embedme
-
Check and commit the modified markdown article
Note: The code file is always the source of truth. If you modify the code directly in the markdown article, it will be overridden by the next yarn embedme