Skip to main content

How to add an "improve this content" button to your GitHub Pages site

2 min read

Summary: If you host your site on GitHub or GitHub Pages, an edit button is one link to a predictable URL. Add it, and readers can propose fixes as pull requests without knowing Git.

At the bottom of this page (and every other page on the site), you’ll notice a subtle plea to help improve the page’s content. That edit button is no dark magic. If you host your site on GitHub or GitHub Pages, collaborative content is a matter of linking to an easily predictable URL.

The difference between publishing with, say, WordPress, and publishing using Jekyll and GitHub Pages is more than a choice of framework or platform. When you treat content as code, when you give prose the same respect that developers have for building mission-critical software, you suddenly open up collaborative workflows whereby content can be transparently versioned, discussed, and improved. As with any other open source project, members of the public can see each line’s history, how it came to be, and propose improvements for the author to review.

If your site’s content is hosted on GitHub (either with Jekyll/GitHub Pages or something like wordpress-github-sync), it’s easy to provide readers with a link to submit changes. All you need is a vanilla HTML link to the following URL (if you’re using another framework, you’ll need to build the URL yourself):

https://github.com/{{ site.github.repository_nwo }}/edit/{{ site.branch }}/{{ page.path }}

Luckily, GitHub Pages has a nice helper to build that URL automatically:

{% github_edit_link %}

Or, if you wanted the helper to build the link as well:

Please {% github_edit_link "help improve this article" %}.

Which would output something like:

Please <a href="http://github.com/benbalter/benbalter.github.com/edit/master/_posts/2015-09-13-github-pages-edit-button.md">help improve this article</a>.

If a user clicks the link, they’ll be prompted to log in or sign up for a GitHub account if they haven’t already, and will be provided with a web-based editor to edit the page’s content. From there, they click the big green “propose change” buttons, which will silently submit a pull request to your site on their behalf, no Git or GitHub knowledge necessary.

Give it a try by clicking the edit button below (suggested improvements to this post welcome), and I encourage you to follow these steps to add a “help improve this content” button to your own site.

Keep reading

Ben Balter

I'm Ben Balter, and I write here about developer platforms, product and engineering leadership, open source, and showing your work. I spent over a decade building developer platforms at GitHub. For five years I was a product manager for trust and safety, shipping 500+ features and the API endpoints behind them to 50M+ developers. I also led a bottom-up rewrite of GitHub Pages and wrote the open source library behind GitHub's license detection, and my open source projects have hundreds of millions of downloads. I wrote Open and Async, the playbook for remote and distributed teams, and shipped a Model Context Protocol (MCP) server alongside it so agents can query it directly. More about the author

Follow along: Bluesky LinkedIn

Originally published September 13, 2015 View revision history

This page is open source Help improve this article on GitHub

Keyboard shortcuts

Search

  • / or ⌘ K Open search
  • ↓ or j ↑ or k Move through results
  • Enter Open the selected result
  • Esc Close search

Go to

  • g then h Home
  • g then p All posts

This page

  • y Copy link to this page
  • ? Show this list