Follow

TIL it’s super easy to modify Press This’s default content, without having to know a ton of JavaScript. petermolnar.net/article/press-

I did things just a wee bit differently. In essence, I (1) add a query param to the Press This URL to indicate the intended post type, and (2) return the appropriate markup. Then, on the receiving end, a _very simple_ regex determines the post type (which _doesn’t_ get sent along as you hit Publish or Save Draft) from the markup. No need to even modify the JS or run complex regexes.

One issue: if you’re not already logged in, the `textarea` won’t be prefilled, and if you then hit Scan the additional query param isn’t seen, so a true (?) server-side solution, while less robust, might still be preferred.

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!