Keep shortcodes hidden when posting

Is there a way to keep shortcodes hidden (but still processed) when including them in a title-less post? I’ve noticed on some of my posts without a title but starting with a shortcode block, that the name of the code gets included in the URL slug as it’s stripped of the special characters and treated as a word.

Good catch, maybe we can strip those out (or provide better control over the slugs). One work-around for now that I can think of: add an HTML comment at the beginning of the post like:

<!-- my title here -->
The actual post here.

And it will trick Micro.blog into using the first words in that comment.

2 Likes

Oh that’s awesome, thanks Manton! I’d love to see control of the slugs get added at some point, but this is a great workaround in the interim. This would especially work great for title-less posts too.

I tried this and it didn’t work. On the design page I received an out of memory error, which was resolved by removing the initial comment line. I don’t think I had a typo in there either.

The memory error might have been coincidence. I’ve seen that before and it usually resolves itself if you want to try again. (Sorry about that… Might need to upgrade the servers again.)

Just tried it again on my test blog and it didn’t throw the error, but the custom title in the comments still isn’t being applied to the slug.

+1 vote for this to be one of the first official Micro.blog t-shirts.

I figured out a way to make this work, be it permanently or until you’re able to change control of the slugs (if you end up being able incorporate that). At the top of a title-less post that starts with a shortcode, adding a paragraph tag with the hidden attribute will not display it inline but allow M.b. to pick that up for the slug:

<p hidden>Custom title here</p>
{{< poetry >}}content starts here{{< /poetry >}}

Edit: I should add that only the first three words will be selected for the slug, even if you enter more

Brilliant suggestion for a pre-determined slug