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

Refactor slugs #726

Merged
merged 12 commits into from
Mar 30, 2024
Merged

Refactor slugs #726

merged 12 commits into from
Mar 30, 2024

Conversation

paulrobertlloyd
Copy link
Collaborator

@paulrobertlloyd paulrobertlloyd commented Mar 29, 2024

Argh. Slugs are a pain. They’re an essential component of the Micropub endpoint and need to be stable and predictable as they can affect generated paths (if a path don’t exist in a content store, things quickly fall apart).

This PR:

  • reverts aspects of Decouple slug property from slug path tokens; add random path token #719, such that a slug property is always created and provided to the postTemplate; either from the value provided in mp-slug, a slugified name property, else a random 5-character string.
  • fixes the slug property not being remembered when a post is deleted
  • updates the post form to read from an existing slug property when editing a post
  • removes the {random} path token, as this token gets regenerated each time the renderPath function is called
  • removes the {uuid} path token for the same reasons
  • removes slug property from front matter when using the Eleventy present (Eleventy supplies page.fileSlug)
  • removes slug property from front matter when using the Jekyll present
  • removes slug property from front matter when using the Hugo present (with Hugo slug is a significant property that affects the published URL, which may lead to unintended URLs if the slug not being used in the post file path)

Need more use cases for it makes sense to supply slug property to front matter properties for different static site generators, however if using postTemplate, the slug property will be provided.

/cc @aciccarello

@paulrobertlloyd paulrobertlloyd self-assigned this Mar 29, 2024
@paulrobertlloyd paulrobertlloyd added bug Something isn't working code quality Making things easier to understand plugin-endpoint Endpoint plug-in labels Mar 29, 2024
@paulrobertlloyd paulrobertlloyd added this to the v1.0 milestone Mar 29, 2024
@paulrobertlloyd paulrobertlloyd marked this pull request as ready for review March 30, 2024 15:57
@paulrobertlloyd paulrobertlloyd merged commit 485bbf3 into main Mar 30, 2024
1 check passed
@paulrobertlloyd paulrobertlloyd deleted the refactor/slug branch March 30, 2024 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code quality Making things easier to understand plugin-endpoint Endpoint plug-in
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant