Skip to main content

Command Palette

Search for a command to run...

Connect a GitHub repo as a source for your articles

Published
3 min read
Connect a GitHub repo as a source for your articles
S

I am the Co-Founder of Hashnode. I write (about) code and keep interest in Venture Funding and startups. Feel free to contact me at sandeep@hashnode.com.

Hey everyone 👋

A few days back our community member Simon Høiberg created the following feature request:

It would be amazing if we could connect a GitHub repository with our articles in markdown files.

This allows us to:

Write our articles in our favorite editor, e.g. Visual Studio Code Update our articles when we push to master branch (or a branch of choice) Enables us to create branches, do PRs and reviews.

For example, I would love to use Hashnode to do release notes and articles on behalf of my Open-Source projects and my company. Since we are multiple people working on these, it would be nice for us to do PRs and code reviews, like we do anything else.

Additionally, this also enables us to do "batch" updates of articles. Sometimes we need to do a simple "search and replace" throughout multiple articles, and this feature would allow us to update a series of articles by virtue of updating the repository.

We thought it's really interesting and started working on it. Today I am happy to announce that you can now connect a GitHub repository as a source for your Hashnode articles. This means you can use your favorite editor to write your article and as soon as you commit it on your GitHub repo it gets published on Hashnode automatically! 🙌

This feature is in private beta and currently available to Hashnode Ambassadors.

Here is how you can enable this feature in two easy steps:

Step 1

Go to your dashboard and visit integrations tab. Click on "Connect Hashnode app on GitHub" button:

Screenshot 2020-10-09 at 10.05.39 PM.png

Once you click on it, you will be redirected to GitHub. You need to install our GitHub app on one of your repos which will house the articles.

Step 2

Now go to your repo where you have installed our GitHub app and create a new .md file. You can name it anything. The content of the file should be in the following format.

---
title: YOUR_TITLE_HERE
slug: CUSTOM_SLUG_HERE
tags: TAG_SLUG_1, TAG_SLUG_2
cover: COVER_IMAGE_URL
domain: YOUR_DOMAIN_NAME_HERE (e.g. sandeep.dev or sandeep.hashnode.dev)
---
Enter article body here

Once you commit, the article gets published on your Hashnode blog automatically.

Just note the following:

  • To use images in your posts, you will have to first upload them using Hashnode uploader. You can then copy the URL and use it in your article.

  • Posts sourced from GitHub can't be edited on Hashnode. You need to edit the files on GitHub and we sync automatically.


This feature is in private beta. We would love to have your feedback and improve further before releasing it to everyone. 🙌

2.5K views

Comments (15)

Join the discussion
A

This is great. But when I embed a YouTube video in my Markdown file as:

%[some-youtube-url]

The video isn't rendered.

F
Felix GV3y ago

Hey there, I'm trying out this feature but struggling to make it work. In the "Github As Source Logs" section, I see: "403 Forbidden" but so far I can't tell why it's doing that, and I haven't found anything on the web either. Did anyone hit this?

A

Hi Felix GV, Unclebigbay from Hashnode customer success here. Happy to help with this.

Could you please share a screenshot of this log you're seeing over the intercom, click here.

Thanks

F
Felix GV3y ago

Ayodele Samuel Adebayo hi, I think I figured it out…

At first, I wrote a wrong entry for publishedAs (I included @ at the beginning), and I guess that’s why it was refused. Then even if I edited that, it still didn’t work. Finally, I merged a new file to GitHub that had the right publishedAs from the get go, and it worked.

1
A

That's great! Felix GV Glad you're able to figure it out now and thanks for getting back.

R

Good !!

S

An additional feature to save the article from GitHub as a draft in hashnode would be a great feature as well. Once all the edits to the article are done on the editor of choice, we can publish the article from hashnode.

A

Is there support coming for using table of contents?

A

Awesome! Just set mine up.

No more switching away from vs code yey 🙌

Did this just by code

D

This is really great functionality. It gives you a lot of flexibility in how you want to write for your blog on hashnode.

But I'd like to see a few more fields. For example:

  • date, for setting a publication date.

But also the meta-description and meta-title are, in my opinion, very important fields that are unfortunately still missing.

If that were in it it would be a 5 star functionality for me

2
M

Thank you for this tutorial. However I struggled two days to find our why it didn't synchronize. When you configure the Hashnode app from the "Integrations" section on your GitHub account, select manually the article's repo and don't let check "All repos" Schermata 2021-11-29 alle 18.43.33.jpg

I even tried to remove a markdown file from my GitHub repo. Is it right if the article has not been deleted from my blog?

D

Sandeep Panda what do you think about using the YAML array syntax for the tags frontmatter?

# square brackets syntax
tags: [TAG_SLUG_1, TAG_SLUG_2]
# list syntax
tags: 
  - TAG_SLUG_1
  - TAG_SLUG_2

The current state (only comma separated) is conflicting with some internal templates of the Hugo static site generator, since these temples expect an array for that field.

E

From step 1, the integration doesn't exist on the tab. I only get to see third party integrations

More from this blog

T

Town Hall - The official Hashnode blog

208 posts

Welcome to the official Hashnode blog. Find our product updates, announcements, interviews, and more here. Get started with Hashnode now.

Connect a GitHub repo as a source for your articles