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.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

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

Okay