This repo is just a template to help you get started quickly. If you're looking for an example of a repo using it, have a look here: https://github.com/maxime1992/my-dev.to
https://dev.to is a free and open source blogging platform for developers.
dev.to (or just DEV) is a platform where software developers write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place within our community.
- Don't be afraid to mess up with one of your articles while editing it
- Same good practices as when you're developing (format, commits, saving history, compare, etc)
- Use prettier to format the markdown and all the code
- Let people contribute to your article by creating a PR against it (tired of comments going sideways because of some typos? Just let people know they can make a PR at the end of your blog post)
- Create code examples close to your blog post and make sure they're correct thanks to Embedme (*1)
*1: Embedme allows you to write code in actual files rather than your readme, and then from your Readme to make sure that your examples are matching those files.
If you prefer not to use Prettier or Embed me, you can do so by simply removing them but I think it's a nice thing to have!
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.
If you want to use Github and Github Actions, a .github/workflows/main.yml
file has been already prepared for you.
- Copy this template to your own Github account by clicking "Use this template"
- Open up this URL with your own username and repo name of the one you just created using the template:
https://github.com/your-username/your-repo-name/settings/secrets/actions
- On the default "Secrets" tab, click on the "New repository secret"
- In the secret name, write
DEV_TO_GIT_TOKEN
- Open up a new tab and go to this URL https://dev.to/settings/extensions. Scroll up to "DEV Community API Keys" and generate a new key. Copy it
- Go back to the Github tab and paste the key you just copied into the secret input
Enjoy.
The following is simply a template that you may want to use for your own version of that repository.
https://dev.to/\<YOUR DEV.TO NICKNAME>
- [<BLOG POST NAME>](https://dev.to/\<BLOG POST LINK>)