> ## Content Index
> Fetch the complete content index at: https://www.autodidacts.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Bookmarklet: Copy Ghost Post ID to Clipboard
- URL: https://www.autodidacts.io/copy-ghost-post-id-to-clipboard-bookmarklet/
- Published: 2026-06-01T23:32:26.000Z
- Updated: 2026-06-03T06:18:54.000Z
- Description: Save several milliseconds with two lines of JavaScript
- Author: Curiositry
- Tags: 100DaysToOffload, Ghost, Bookmarklet, JavaScript

I often need to get the internal UUID for a Ghost CMS post: for example, in order to [save it as markdown](https://www.autodidacts.io/script-export-post-as-markdown-via-ghost-admin-api/).

Previously, I would go to the post, append `/edit` to the URL, hit enter, and then copy the last section of the URL, which is the UUID for the post in the editor. Tedious!

As I suspected, the post ID is right there in the HTML of the post: it’s used to load comments for the right post. So, [like I did](https://gist.github.com/curiositry/a47551d970255301197a?ref=autodidacts.io) for appending `/edit` to the URL:

Drag the link below to your bookmarks bar and click it when you’re viewing a post on your Ghost blog:  
[Edit Post!](javascript:void%20function%28%29{var%20url%20=%20window.location;newUrl%20=%20url+%22/edit%22,window.location.replace%28newUrl%29}%28%29;)  
It will append `/edit` to the url and reload, so you can edit your post  
— Built with ❤ by [@curiositry](http://curiositry.github.io/?ref=autodidacts.io) ([Twitter](http://twitter.com/curiositry?ref=autodidacts.io), [GitHub](http://github.com/curiositry?ref=autodidacts.io)) 

.... and [linking to text fragments](https://www.autodidacts.io/scroll-to-text-fragment-bookmarklet/), and [jumping between staging and production versions of a site](https://www.autodidacts.io/old-site-new-site-bookmarklets/), I wrote a two-line bookmarklet to extract the current post ID, and put it on the clipboard:

```javascript
let postId = document.querySelector("[data-post-id]").getAttribute("data-post-id");
navigator.clipboard.writeText(postId).then(() => {
    console.log('Post ID copied to clipboard:', postId);
});
```

Drag the link below to your bookmarks bar, and click on it when you want to get a post ID from your blog:

[Copy Ghost Post ID to Clipboard](javascript:void%20function%28%29{let%20a=document.querySelector%28%22[data-post-id]%22%29.getAttribute%28%22data-post-id%22%29;navigator.clipboard.writeText%28a%29.then%28%28%29=%3E{console.log%28%22Post%20ID%20copied%20to%20clipboard:%22,a%29}%29}%28%29;) 

(Thanks to Chris Zarate for making the [excellent bookmarklet encoder](https://chriszarate.github.io/bookmarkleter/?ref=autodidacts.io) applet that I use every time I need to make a bookmarklet. It works great, and can even be saved and used offline.)