Opened 5 years ago

Closed 2 years ago

#6627 closed enhancement (wontfix)

Canonization, individual editing of permalinks

Reported by: synapsestudios Owned by: markjaquith
Priority: normal Milestone:
Component: Canonical Version: 2.5
Severity: normal Keywords: needs-patch
Cc: janbrasna

Description

It would be nice to see an option to view all permalinks available. Currently only one is shown even though multiple exist. Possibly using a method similar to Google calendar telling you "+4 more" which is a link that displays all the other ways to access that post/page.

Also, I am not sure if it is possible but it might be useful to some to be able to have different slugs for the same article.

Example:
-- slug of test exists in category-a
-- create a new post with a slug of test in category-a and category-b which becomes test-2 across the board
-- allow for user to specify category-a/another-test and category-b/test

Change History (25)

  • Milestone 2.6 deleted

comment:2   ryan5 years ago

Do you mean post permalinks? There is only one permalink for a post. We go trough pains to make sure there is only one canonical permalink for a given post. That canonical link is the only one that should be used or displayed.

comment:3 follow-up: ↓ 4   synapsestudios5 years ago

With a post permalink, there can be multiple ways of accessing that post depending on how the permalink structure is created. For example, my permalink structure is as follows: /%category%/%postname%/

Which means when I have a post in more than one category, there is more than one way to access the same post.

Additionally, the same content can be reached via author/{authorName}/{postSlug}

comment:4 in reply to: ↑ 3   ryan5 years ago

Replying to synapsestudios:

With a post permalink, there can be multiple ways of accessing that post depending on how the permalink structure is created. For example, my permalink structure is as follows: /%category%/%postname%/

Which means when I have a post in more than one category, there is more than one way to access the same post.

That is a deficiency in our canonical redirect code then.

Additionally, the same content can be reached via author/{authorName}/{postSlug}

That's not really a permalink. Perhaps canonical redirect should redirect author links containing post slugs to the post's canonical permalink.

comment:5   DD325 years ago

  • Milestone set to 2.7
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

I'll handle the category situation for 2.7 The author situation seems contrived. WordPress would never generate those links.

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9193]) Redirect alternate is_single() URLs (like multiple category-based urls) to the canonical URL. fixes #6627

  • Resolution fixed deleted
  • Status changed from closed to reopened

Since [9193] my rewrite rules (Plugin : NextGEN Gallery) for post are not longer working anymore... I'm not sure if I done it in the past in a wrong way but the line

$redirect_url = get_permalink( url_to_postid( $requested_url ) );

Removes all my query args for posts. How should I add now additional args to the post url ?

@alexrabe: I also have this problem for my WP-Email and WP-Print plugin, what I did was to have template redirect loads first before the canonical url. This is what I did

!php
add_action('template_redirect', 'wp_print', 5);

Thanks for the note GamerZ,

I'm not sure if I can use it in this way... I request the args with get_query_var() during my shortcodes are proceeded, don't thinks I can use here a template redirect. Maybe I understand this whole rewrite sytems not fully and I'm doing something terrible wrong. I will have a look for your plugins

I see, I think I got what you mean. ShortCode are parsed at the the_content() level and hence I think the canonical url redirect has already taken place.

In canonical.php, if you comment out this line

add_action('template_redirect', 'redirect_canonical');

does it work?

I tried many methods, using the WP rewrite endpoints API and it seems that it will not detect other query vars except its own.

Yes it works when comment out the redirect_canonical. If I hook into url_to_postid() I see taht it will now passed two times... the first time it return the correct query but due to the redirect it will then not longer contain my query args.

@markjaquith
Do we really need [9193] in WP 2.7 ?

  • Component changed from Administration to Permalinks

@mark
Is it possible to get some feedback before WP2.7 will be released ?

I'm a little bit confused about the problem you're having. I have no problem passing arbitrary query strings:

http://mark-mbp.local/~mark/wp/2008/11/private/?foo=bar

Does not redirect.

Ah, you mean additional things on the path. Like:

http://example.com/2008/11/postname/gallery/

I can roll this back pending a more cautious fix. Maybe compare the canonical URL to the current URL to see if they are the same + some suffix. But this is fine to punt to 2.8

(In [9649]) Revert [9193]. See #6627. Will revisit for 2.8

  • Milestone changed from 2.7 to 2.8

Many thanks for your decision, let me know if I should change anything in my rewrite rules for 2.8

  • Cc janbrasna added
  • Keywords permalink slug canonization added
  • Summary changed from View all permalinks + individual editing of permalinks to Canonization, individual editing of permalinks

Related #3451 (see comments).

  • Component changed from Permalinks to Canonical
  • Keywords needs-patch added; permalink slug canonization removed
  • Milestone changed from 2.8 to Future Release

Moving to Future, pending a patch

  • Milestone changed from Future Release to 2.9
  • Milestone changed from 2.9 to Future Release
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

wontfix: We already redirect singular posts; ticket: Having multiple entry points for a post also goes right against having Canonical in the first place.

Note: See TracTickets for help on using tickets.