Skip to content

Add meta robots noindex to search and profile #10120

Merged
andreslucena merged 8 commits intodecidim:developfrom
i-need-another-coffee:feature/add-no-index-meta
Oct 4, 2023
Merged

Add meta robots noindex to search and profile #10120
andreslucena merged 8 commits intodecidim:developfrom
i-need-another-coffee:feature/add-no-index-meta

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Nov 26, 2022

🎩 What? Why?

In this PR we are adding a <meta name="robots" content="noindex"> tag to avoid, user profiles being indexed by the search engines.
This is a basic implementation of Dereference (new) profile pages to limit spam exposure and disincentivise spam accounts

📌 Related Issues

Link your PR to an issue

Testing

  1. Visit search page
  2. Make sure it has <meta name="robots" content="noindex"> in the source
  3. Visit user profile page
  4. Make sure it has <meta name="robots" content="noindex"> in the source

📷 Screenshots

Please add screenshots of the changes you're proposing
Description

♥️ Thank you!

@PierreMesure
Copy link
Copy Markdown
Contributor

I'm hoping from your parenthesis around (new) that it will be possible to decide how long new profiles are not indexed, and maybe keep them unindexed permanently? 😊

@alecslupu
Copy link
Copy Markdown
Contributor Author

I'm hoping from your parenthesis around (new) that it will be possible to decide how long new profiles are not indexed, and maybe keep them unindexed permanently? blush

At the moment no profile is being indexed, hence the draft state.

@andreslucena
Copy link
Copy Markdown
Member

andreslucena commented Sep 7, 2023

Hi all! FYI I was reviewing old PRs and found this one. In mentioned to @decidim/product and we agreed that we wanted this change, with a couple of caveats:

  • Add this same de-reference to the SearchesController
  • After this is merged, we can make new PRs to the CHANGELOG of older releases (so it appears in the published Releases notes), making a reference to this PR and explaining that you can implement it on you platform with the robots.txt

@alecslupu alecslupu force-pushed the feature/add-no-index-meta branch from 6e93f73 to f961de3 Compare September 30, 2023 23:52
@alecslupu alecslupu added module: core type: change PRs that implement a change for an existing feature labels Oct 1, 2023
@alecslupu alecslupu changed the title Dereference (new) profile pages to limit spam exposure and disincenti… Add meta robots noindex to search and profile Oct 1, 2023
@alecslupu alecslupu force-pushed the feature/add-no-index-meta branch 2 times, most recently from 5c6b484 to 256fef3 Compare October 1, 2023 00:18
@alecslupu alecslupu force-pushed the feature/add-no-index-meta branch from 256fef3 to 57d98cc Compare October 1, 2023 00:19
@alecslupu alecslupu marked this pull request as ready for review October 2, 2023 22:33
@alecslupu alecslupu requested a review from a team October 3, 2023 05:11
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Wow, really clean comparing to the first approach, congratulations!

Can you add a spec for these changes? I was thinking in something like this:

diff --git a/decidim-core/spec/system/user_profile_spec.rb b/decidim-core/spec/system/user_profile_spec.rb
index 9d0b85a9e8..d0e57b9afa 100644
--- a/decidim-core/spec/system/user_profile_spec.rb
+++ b/decidim-core/spec/system/user_profile_spec.rb
@@ -40,6 +40,10 @@ describe "Profile", type: :system do
       visit decidim.profile_path(user.nickname)
     end
 
+    it "is not indexable by crawlers" do
+      expect(page.find('meta[name="robots"]', visible: false)[:content]).to eq("noindex")
+    end
+
     it "shows user name in the header, its nickname and a contact link" do
       expect(page).to have_selector("h1", text: user.name)
       expect(page).to have_content(user.nickname)

Of course we should move it to a shared example so its reusable in the different pages, but this can be a starting point 😄

Comment thread decidim-core/app/views/decidim/profiles/show.html.erb Outdated
@alecslupu alecslupu requested a review from andreslucena October 3, 2023 12:20
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

It seems like you didn't push or applied my suggestions. Maybe it's better to accept the changes through the GitHub UI, so it's automatically marked as solved?

Comment thread decidim-core/app/views/decidim/profiles/show.html.erb Outdated
Comment thread decidim-core/app/views/decidim/user_activities/index.html.erb
@andreslucena
Copy link
Copy Markdown
Member

Also, the specs that I mentioned aren't here. Maybe you forgot to push?

@alecslupu
Copy link
Copy Markdown
Contributor Author

Also, the specs that I mentioned aren't here. Maybe you forgot to push?

The changes are visible in this PR now.

@alecslupu alecslupu requested a review from andreslucena October 3, 2023 13:33
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

There's a failing spec, can you check it out 🙏🏽 ?

@alecslupu
Copy link
Copy Markdown
Contributor Author

There's a failing spec, can you check it out 🙏🏽 ?

Missing translation. Will be addressed today.

@alecslupu alecslupu requested a review from andreslucena October 4, 2023 10:53
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Two little changes and this is ready 😄

Comment thread decidim-core/config/locales/en.yml Outdated
Comment thread config/i18n-tasks.yml Outdated
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
@alecslupu alecslupu requested a review from andreslucena October 4, 2023 12:45
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

👍🏽

@andreslucena andreslucena merged commit 6903686 into decidim:develop Oct 4, 2023
@alecslupu alecslupu deleted the feature/add-no-index-meta branch October 4, 2023 13:03
entantoencuanto added a commit that referenced this pull request Oct 5, 2023
* develop:
  Fix admin redesign module (#11648)
  Apply flash styles to Announcements (#11708)
  Refactor oneliners of redesigned_a11y.js (#11713)
  Redesign: fix votings admin module issues (#11704)
  Add meta robots noindex to search and profile (#10120)
entantoencuanto added a commit that referenced this pull request Oct 5, 2023
* develop:
  Fix admin redesign module (#11648)
  Apply flash styles to Announcements (#11708)
  Refactor oneliners of redesigned_a11y.js (#11713)
  Redesign: fix votings admin module issues (#11704)
  Add meta robots noindex to search and profile (#10120)
entantoencuanto added a commit that referenced this pull request Oct 6, 2023
* feature/renaming-redesign:
  Use default current participatory space scope as root on scopes_select_tag called from bulk actions
  restore the imports thing (compilation fails for initiatives)
  change testing color: dequelabs/axe-core#3513 (comment)
  Fix admin redesign module (#11648)
  Apply flash styles to Announcements (#11708)
  Refactor oneliners of redesigned_a11y.js (#11713)
  Redesign: fix votings admin module issues (#11704)
  Add meta robots noindex to search and profile (#10120)
  Refactor dropdown scroll to menu (#11710)
  Remove unused partial
  Remove REDESIGN_PENDING obsolete comand
  Redesign: fix assembly members sidebar menu (#11699)
  Redesign: fix conferences admin module issues (#11703)
  Redesign: fix assemblies admin module issues (#11702)
andreslucena added a commit that referenced this pull request Oct 16, 2023
* Add meta tag no-index

* Apply review recommendations

* Add missing key

* Ignoring key

* More i18n keys

* Moving unusued keys

* Apply suggestions from code review

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

---------

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core type: change PRs that implement a change for an existing feature

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants