Skip to content

Instantly share code, notes, and snippets.

@gurdiga
Last active January 29, 2026 20:37
Show Gist options
  • Select an option

  • Save gurdiga/9513feec77c98bd4a1634e6788ff54b0 to your computer and use it in GitHub Desktop.

Select an option

Save gurdiga/9513feec77c98bd4a1634e6788ff54b0 to your computer and use it in GitHub Desktop.
Quick-edit “Pencil” link for Blogspot.
<script>
var blogId = document.querySelector('link[rel="service.post"]').href.match(/\d+/)[0];
console.log('blogId', blogId);
setTimeout(function() {
document.querySelectorAll('.post-footer').forEach(function(footer) {
var postId = footer.parentElement.querySelector('a').name;
console.log('postId', postId);
var href = 'https://www.blogger.com/post-edit.g?blogID=' + blogId + '&postID=' + postId + '&from=pencil';
var a = document.createElement('a');
a.href = href;
a.textContent = 'Pencil';
footer.appendChild(a);
console.log('Added pencil', a);
});
}, 1000);
</script>
@barrydesborough-cmd
Copy link

Works great. I tried to adapt this for pages too, just replacing the string "post" to "page", and the prompt, but no joy. I don't know why.

At the moment, all I am doing is manually adding a link to the appropriate edit URL to each post and page. I just change the last full stop/period/dot to a link to the edit page.

If anyone can explain why the page script doesn't work, I'd appreciate it.

@barrydesborough-cmd
Copy link

Hi Gurdica. As I said, your gadget worked fine. I tried making an equivalent one for pages, but I can't make it work. Do you think you could edit it for pages? Ideally, one gadget would work for both posts and pages. If you can, thank you in advance! :)

@barrydesborough-cmd
Copy link

If I try to use your widget on a page, I get a URL which doesn't work because it has "post" in the URL, e.g.
https://draft.blogger.com/blog/post/edit/(numbers)
If I change it to
https://draft.blogger.com/blog/post/edit/(numbers)
it works.

How to get the second (page edit) URL from a widget?

@barrydesborough-cmd
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment