WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 months ago

#11360 closed enhancement (fixed)

Don't nofollow links within the site

Reported by: caesarsgrunt Owned by: swissspidy
Milestone: 4.5 Priority: normal
Severity: normal Version: 2.9
Component: Comments Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

Relative links or links with the site's own domain shouldn't be nofollowed.

This use of nofollow is damaging to the site's search engine rankings.

Attachments (3)

11360.diff (576 bytes) - added by caesarsgrunt 7 years ago.
11360.2.diff (2.9 KB) - added by swissspidy 8 months ago.
11360.3.diff (3.2 KB) - added by swissspidy 7 months ago.

Download all attachments as: .zip

Change History (19)

#1 @caesarsgrunt
7 years ago

See also #11359 (Don't nofollow links in admin comments)

@caesarsgrunt
7 years ago

#2 @caesarsgrunt
7 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Attached patch (didn't mean to upload it twice...) doesn't add nofollow to links within the site (eg {exapmle.com or /). It does add nofollow to links to other sites (eg google.com), including tricky sites whose domain starts with the siteurl (eg example.com.badsite.com).

#3 @dd32
7 years ago

didn't mean to upload it twice...

I just deleted 11360.2.diff to keep things straight forward :)

#4 @caesarsgrunt
7 years ago

Thanks dd32.

I'd quite like some feedback on this patch - is there anything wrong with this approach? If not, it'd be really nice to get it into 2.9... :-)

#5 @caesarsgrunt
7 years ago

  • Milestone changed from Unassigned to 3.0

#6 follow-up: @hakre
7 years ago

Some feedback: How to reflect mixed usage of HTTP and HTTPS in that patch? Any Idea?

#7 @hakre
7 years ago

  • Keywords changed from has-patch, needs-testing to has-patch needs-testing

#8 in reply to: ↑ 6 ; follow-up: @caesarsgrunt
7 years ago

Replying to hakre:

Some feedback: How to reflect mixed usage of HTTP and HTTPS in that patch? Any Idea?

Not sure what you mean... does http/https make any difference in the patch?

#9 in reply to: ↑ 8 @nacin
7 years ago

Replying to caesarsgrunt:

Replying to hakre:

Some feedback: How to reflect mixed usage of HTTP and HTTPS in that patch? Any Idea?

Not sure what you mean... does http/https make any difference in the patch?

The get_option() call there will only return the http:// link, not https://. There's a new function home_url() that could be used, but that still wouldn't prevent an http:// link from not being picked up on a forced SSL site and vice versa.

At the very least, using home_url() makes sense to make sure the right protocol is searched for. Checking both protocols wouldn't be a bad idea though.

#10 @nacin
6 years ago

  • Milestone changed from 3.0 to Future Release
  • Type changed from defect (bug) to enhancement

#11 follow-up: @chriscct7
22 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

This was resolved, in later commits, including #10550

#12 in reply to: ↑ 11 @ocean90
20 months ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Replying to chriscct7:

This was resolved, in later commits, including #10550

No, it isn't. #10550 is about reply to links.

#13 @swissspidy
8 months ago

  • Keywords needs-patch added; has-patch needs-testing removed

Needs a new patch using home_url(), perhaps even checking for https and http (using set_url_scheme() maybe?)

@swissspidy
8 months ago

#14 @swissspidy
8 months ago

  • Keywords has-patch has-unit-tests added; needs-patch removed
  • Milestone changed from Future Release to 4.5

11360.2.diff is a refreshed patch that ensures home_url() gets ignored, no matter if https or http is used.

Also includes unit tests for wp_rel_nofollow()

#15 @swissspidy
7 months ago

  • Keywords commit added

@swissspidy
7 months ago

#16 @swissspidy
7 months ago

  • Owner set to swissspidy
  • Resolution set to fixed
  • Status changed from reopened to closed

In 36125:

Comments: Don't nofollow links within the site.

Fixes #11360.

Note: See TracTickets for help on using tickets.