DEV Community

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

Posted on • Originally published at denizaksimsek.com on

1 2

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.

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay