WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 3 years ago

#6627 closed enhancement (wontfix)

Canonization, individual editing of permalinks

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

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)

comment:1 synapsestudios6 years ago

  • Milestone 2.6 deleted

comment:2 ryan6 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: synapsestudios6 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 ryan6 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 DD326 years ago

  • Milestone set to 2.7

comment:6 markjaquith6 years ago

  • 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.

comment:7 markjaquith6 years ago

  • 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

comment:8 alexrabe5 years ago

  • 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 ?

comment:9 GamerZ5 years ago

@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);

comment:10 alexrabe5 years ago

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

comment:11 GamerZ5 years ago

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.

comment:12 alexrabe5 years ago

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 ?

comment:13 ryan5 years ago

  • Component changed from Administration to Permalinks

comment:14 alexrabe5 years ago

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

comment:15 markjaquith5 years ago

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.

comment:16 markjaquith5 years ago

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

comment:17 markjaquith5 years ago

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

comment:18 jacobsantos5 years ago

  • Milestone changed from 2.7 to 2.8

comment:19 alexrabe5 years ago

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

comment:20 janbrasna5 years ago

  • 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).

comment:21 Denis-de-Bernardy5 years ago

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

comment:22 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.8 to Future Release

Moving to Future, pending a patch

comment:23 Denis-de-Bernardy5 years ago

  • Milestone changed from Future Release to 2.9

comment:24 ryan4 years ago

  • Milestone changed from 2.9 to Future Release

comment:25 dd323 years ago

  • 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.