Giter VIP home page Giter VIP logo

Comments (6)

janboddez avatar janboddez commented on August 18, 2024

Added in dd60f1d

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

If these are active and a post is given a name of, e.g., 2020, you'll get a 404 if no posts for that year are found, rather than the single post with that slug.

I.e., we have to prevent notes/likes get a 4-digit number as a slug. WordPress already does this for pages, or, depending on your permalink setup, for posts, by adding a -2 suffix.

We should probably do the same, i.e., either always add -2 or do it only when there's a chance of conflicting slugs.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

[O]nly when there's a chance of conflicting slugs.

So not when autogenerated slugs are active, and---possibly, although this could be challenged---also not when actual date-based permalinks are an option, and selected. The issue with not doing it for the latter scenario is that a conflict may still occur once the permalink option is changed.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

In WP core, what happens is the -2 only gets added when there's potential for a conflict. If afterward the permalink settings are changed, the (now conflicting) single post comes out on top. There's then no way to reach the archive for that year anymore.

We should probably mimic this behavior.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

See https://github.com/WordPress/wordpress-develop/blob/ec91ec56be44d8cdbc611758b9721860aae60491/src/wp-includes/post.php#L5049 and following.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

Added in 50fd2b0, although archives take precedence over single posts, should there be a slug conflict. Think I like it that way, so that month and day archives don't all get hijacked by a single post.

from indieblocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.