Skip to content

Use nofollow for Discovery search facet links - #4785

Merged
tdonohue merged 1 commit into
DSpace:mainfrom
alanorth:no-follow-facets
Nov 18, 2025
Merged

tdonohue merged 1 commit into
DSpace:mainfrom
alanorth:no-follow-facets

Conversation

@alanorth

@alanorth alanorth commented Oct 24, 2025 •

Copy link
Copy Markdown
Contributor

References

Description

Use rel="nofollow" on Discovery search facet links to signal to well-behaved bots that they should not crawl facets. Faceted search results are derivative content of primary DSpace objects and cause excessive load on the server and even exhaust your crawl budget on crawlers like Google.

Should this be configurable? How? Is there a case where a site would want bots to crawl the exponential combinations of search facets?

See: https://developers.google.com/search/blog/2024/12/crawling-december-faceted-nav
See: https://developers.google.com/search/docs/crawling-indexing/crawling-managing-faceted-navigation

Instructions for Reviewers

Please add a more detailed description of the changes made by your PR. At a minimum, providing a bulleted list of changes in your PR is helpful to reviewers.

List of changes in this PR:

  • First, add rel="nofollow" to facet links on Discovery search pages

Include guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.

Inspect facet links on Discovery search, entity, community, and collection pages to see if they have the rel="nofollow" tag.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

Use `rel="nofollow"` on Discovery search facet links to signal to
well-behaved bots that they should not crawl facets. Faceted search
results are derivative content of primary DSpace objects and cause
excessive load on the server and even exhaust your crawl budget on
crawlers like Google.

See: https://developers.google.com/search/blog/2024/12/crawling-december-faceted-nav
See: https://developers.google.com/search/docs/crawling-indexing/crawling-managing-faceted-navigation
@alanorth alanorth added needs discussion performance / caching Related to performance, caching or embedded objects labels Oct 24, 2025
@tdonohue tdonohue added port to dspace-7_x port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release labels Oct 24, 2025
@tdonohue tdonohue moved this to 🙋 Needs Reviewers Assigned in DSpace 10.0 Release Oct 24, 2025
@tdonohue

Copy link
Copy Markdown
Member

FWIW, I agree that sites shouldn't want crawlers to get "stuck" in search filters. So, adding rel="nofollow" makes sense to me.

As a sidenote, by default, the entire /search page and the search component in general are excluded from Server Side Rendering (SSR). See https://github.com/DSpace/dspace-angular/blob/main/src/environments/environment.production.ts#L23 and https://github.com/DSpace/dspace-angular/blob/main/src/environments/environment.production.ts#L32

This means that crawlers likely won't be able to crawl the search pages/components anyways (as most major crawlers still rely on SSR, to my knowledge). So, this rel="nofollow" may not have a large impact...but, it still is useful for sites that wish to tweak these default SSR settings (or as well-behaved crawlers get "smarter", it could be useful)

@tdonohue tdonohue added the bug label Oct 24, 2025
@alanorth

alanorth commented Oct 24, 2025 •

Copy link
Copy Markdown
Contributor Author

As a sidenote, by default, the entire /search page and the search component in general are excluded from Server Side Rendering (SSR). See main/src/environments/environment.production.ts#L23 and main/src/environments/environment.production.ts#L32

Good point. I think Googlebot is the biggest bot most sites are worried about, and they do execute JavaScript if I recall correctly. But they also follow robots.txt and we disallow search by default.

So maybe adding rel="nofollow" is actually not doing anything for us in effect now that I think about it.

@tdonohue

Copy link
Copy Markdown
Member

@alanorth : Yes, I honestly don't know that rel="nofollow" will do anything by default. But, it's still a "best practice"... and if people change the default settings, then the rel="nofollow" may be beneficial to them.

So, overall, I'm not against adding this PR simply because it's a good best practice.

@alanorth

Copy link
Copy Markdown
Contributor Author

Hi @tdonohue. I agree that it's a best practice and worth pursuing (Google themselves recommend this after all). I've deployed this to production and will monitor changes to my server load, Google search console, etc.

@nwoodward nwoodward left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @alanorth. I confirmed this adds the nofollow. I'd be curious to know if this has had any impact on your production instance in the last few weeks.

@github-project-automation github-project-automation Bot moved this from 🙋 Needs Reviewers Assigned to 👍 Reviewer Approved in DSpace 10.0 Release Nov 14, 2025
@tdonohue tdonohue added this to the 10.0 milestone Nov 18, 2025

@tdonohue tdonohue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @alanorth ! This looks good to me too.

@tdonohue
tdonohue merged commit bf110c7 into DSpace:main Nov 18, 2025
@github-project-automation github-project-automation Bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace 10.0 Release Nov 18, 2025
@dspace-bot

Copy link
Copy Markdown
Contributor

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-7_x
git worktree add -d .worktree/backport-4785-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-4785-to-dspace-7_x
git switch --create backport-4785-to-dspace-7_x
git cherry-pick -x f1e4bf55e961e943eb70447bd99762822e951004

@dspace-bot

Copy link
Copy Markdown
Contributor

Backport failed for dspace-8_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-8_x
git worktree add -d .worktree/backport-4785-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-4785-to-dspace-8_x
git switch --create backport-4785-to-dspace-8_x
git cherry-pick -x f1e4bf55e961e943eb70447bd99762822e951004

@dspace-bot

Copy link
Copy Markdown
Contributor

Successfully created backport PR for dspace-9_x:

@tdonohue

Copy link
Copy Markdown
Member

@alanorth : this was only possible to auto-backport to 9.x. But, if you wanted to manually backport it to 8.x and 7.6.x, then we could merge it there as well.

@tdonohue tdonohue removed the port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release label Nov 18, 2025
@alanorth
alanorth deleted the no-follow-facets branch November 19, 2025 04:35
@alanorth

Copy link
Copy Markdown
Contributor Author

Thanks @tdonohue. Ported to DSpace 8.x in #4831 and DSpace 7.x in #4832.

@alanorth alanorth removed needs discussion port to dspace-7_x port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Nov 19, 2025
@alanorth

Copy link
Copy Markdown
Contributor Author

@nwoodward to get back to your question, after having this deployed on production for several weeks I don't see any change in my Google Search Console. No warnings either.

Search performance:

Screenshot 2025-11-19 at 09-20-18 Overview

Indexing:

Screenshot 2025-11-19 at 09-20-25 Overview

@tdonohue tdonohue added the component: SEO Search Engine Optimization label Nov 19, 2025
4science-it pushed a commit to 4Science/dspace-angular that referenced this pull request Aug 18, 2026
DSC-2820 fixed the views wording in the downloads tab of the statistics

Approved-by: Andrea Barbasso
@saschaszott

Copy link
Copy Markdown
Member

@alanorth , I expanded on your idea and added rel="nofollow" to more <a> elements. What do you think about the changes in the PR #6607 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug component: SEO Search Engine Optimization performance / caching Related to performance, caching or embedded objects

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants