DEV Community

Deniz Akşimşek
Deniz Akşimşek

Posted on • Originally published at denizaksimsek.com on

Tip: Instantly Edit Your Eleventy Site on Github

You’re looking at the blog post you made yesterday, when suddenly a typo catches your eye. What is the fastest way to fix it? (Skip to code).

Note: This tip assumes you use GitHub. It could likely be adapted easily for other Git providers.

Add the following to your base layout (note the {{ }} and replace <username>/<repo> with the repo for the site):

<script>
addEventListener('keyup', e => {
  if (e.shiftKey === true) {
    switch (e.keyCode) {
    case 69: // E
      window.location = 'https://github.com/<username>/<repo>/edit/master/{{page.inputPath}}'
      break 
    }
  } 
})
</script>
Enter fullscreen mode Exit fullscreen mode

When you press Shift+E, the GitHub editor will open to the current page! The switch statement is there because I used to have a few more hotkeys.

Discussion (0)