Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Use permalink instead of slug in Front Matter #2

Open
miklb opened this issue Apr 29, 2016 · 7 comments
Open

Suggestion: Use permalink instead of slug in Front Matter #2

miklb opened this issue Apr 29, 2016 · 7 comments

Comments

@miklb
Copy link

miklb commented Apr 29, 2016

Just a suggestion for default Front Matter, permalink is a predefined variable.

@voxpelli
Copy link
Owner

That's maybe something to consider. It would make it easier to figure out the final URL if the formatter takes care of generating it, but would also make it hard to change permalink formats later on.

I think I'm currently more inclined to instead make the expected permalink format configurable, rather than be the hard-coded %Y/%d that it currently is:

var url = strftime('%Y/%m', data.properties.published[0]) + '/' + (slug ? slug + '/' : '');
Then as long as the configuration matches between the formatter and the actual Jekyll instance then everything would be fine.

(To go a bit over the top: It would be neat if the top Micropub project that glues all three modules together would actually download the Jekyll config and use the data in there to configure the permalink 😄)

@miklb
Copy link
Author

miklb commented Apr 29, 2016

I wasn't even thinking about that scenario. I don't use %Y %d in my article permalink, so I was thinking for myself not generally.

@voxpelli
Copy link
Owner

I see, you use just title in your permalinks, hmm...

Won't you run quite a high risk of duplicates then?

Three possible solutions that I'm thinking of:

  1. Make the prefix that's sent into strftime() configurable and optional. So defined as either a string or false.
  2. Make it possible to override the entire strftime() part with a custom callback.
  3. Make a more extended slug-generator that can take at least a subset of the exact definition that Jekyll accepts.

Number 1 would be absolutely easiest and would enable you to deactivate the prefix for your blog (when also made configurable through the micropub glue)

@voxpelli
Copy link
Owner

A closer look reveals that there's even more parts that may need to be configurable to adapt for both yours and my permalink formats.

Will try to give it a look asap when I get some time.

Luckily enough a bad result currently just gives a bad UX, no data corruption 👍

@miklb
Copy link
Author

miklb commented Apr 29, 2016

Yes, I did realize the issue was with permalinks. I'm just not a fan of date based URLs, but there is a possibility of duplicates.

I think right now I can check if post.permalink is empty & use slug.

Configurations would be nice, but no rush on my account.

@miklb
Copy link
Author

miklb commented Apr 30, 2016

Poking around at this some more, for the short term I can set permalinks: pretty in _config.yml and it will give me a URL. I set my article permalink in the front matter usually anyway, so i can keep the title as URL for most items.

Obviously long term will be configuration. I might also manually change slug to permalink in my front matter generation for my own uses.

@voxpelli
Copy link
Owner

Permalink formats are now configurable. While it doesn't solve this issue, it's still one step in the right direction.

Related issue: voxpelli/webpage-micropub-to-github#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants