Closed KixPanganiban closed 2 years ago
Nice idea!
Some notes:
xxx-1
, xxx-2
, or just generate short random strings (or use part of the page id) and append to every generated slug.Nice idea!
Some notes:
- It's quite easy to get plain text representation for title, this is the data structure: Concat the strings, ignore the formatting attributes, and encode characters that are not allowed in an URL.
- Need to consider duplicate titles. Maybe count the them and add numbers
xxx-1
,xxx-2
, or just generate short random strings (or use part of the page id) and append to every generated slug.
Sounds good! Something like <first 6 chars of page id>-<slug>.html
might work, ie 71ebc4-bye-wordpress-hello-notablog.html
.
I'll see if I can put together a PR for this in a day or two, and then hide it behind a config.json
flag (for backwards compatibility).
I have a suggestion: how about putting the random string after the slug? I think it's more consistent that generated urls and user specified urls both start with the slug. And it seems to be more common, sites like Medium does it.
For backward compatibility, yeah we could hide it with a config toggle for now, but I hope it would eventually be the default for pages without user specified slug, and we release a version with breaking changes, given that for important posts I would already be using user specified slugs, and for other posts changes are acceptable.
Feel free to let me know if you're blocked by something!
I put this together: https://github.com/dragonman225/notablog/pull/29
I just saw your comment about having the ids after, and that makes sense to me. I'll make that change!
It would be nice if we could have the option to automatically generate the page URL using its title's slug instead of its Notion page id. For example, with a title of
How to setup Notablog
, we could getmydomain.com/how-to-setup-notablog.html