Skip to content

(#4684) Remove Disqus from the Platform#5133

Closed
dev-rana-publicis wants to merge 1 commit intodevelopfrom
ticket/4684-remove-disqus
Closed

(#4684) Remove Disqus from the Platform#5133
dev-rana-publicis wants to merge 1 commit intodevelopfrom
ticket/4684-remove-disqus

Conversation

@dev-rana-publicis
Copy link
Copy Markdown
Contributor

@dev-rana-publicis dev-rana-publicis commented Feb 10, 2026

Closes #4684

ODE 1078

@dev-rana-publicis dev-rana-publicis marked this pull request as ready for review February 12, 2026 18:05
@dev-rana-publicis dev-rana-publicis requested a review from a team as a code owner February 12, 2026 18:05
@laurelthrash laurelthrash requested review from a team, adrianacastaneda and lburack February 12, 2026 18:20
@lburack
Copy link
Copy Markdown

lburack commented Feb 12, 2026

Disqus comments appeared to be removed from the front-end but the Blog Series still has a required field for Comments, with the option to "allow comments". When I had this selected, the Disqus banner doesn't display (which is what we want), but this field should be removed from the Blog Series entirely.

Screenshot 2026-02-12 at 1 56 07 PM

@dev-rana-publicis dev-rana-publicis force-pushed the ticket/4684-remove-disqus branch from 242e421 to 1c71eb6 Compare February 13, 2026 16:13
Copy link
Copy Markdown

@adrianacastaneda adrianacastaneda left a comment

Choose a reason for hiding this comment

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

Checkmark for IA ✅

@laurelthrash
Copy link
Copy Markdown

Update: this PR has the needed UX & QA checks. Holding on tech review and merge as we want to merge PR # 5132 prior to this PR. Cc: @andyvanavery31

@dev-rana-publicis dev-rana-publicis force-pushed the ticket/4684-remove-disqus branch from 1c71eb6 to fbbdeb4 Compare February 19, 2026 17:27
Copy link
Copy Markdown

@lburack lburack left a comment

Choose a reason for hiding this comment

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

Passes my IA review!

@bryanpizzillo
Copy link
Copy Markdown
Member

@dev-rana-publicis From copilot when asked did any files get missed...

I'll start by reviewing the PR changes and understanding what's being removed, then search the codebase for any references that might have been missed.Let me start by reviewing the PR to understand what blocks, fields, and modules are being removed, then search the codebase for any remaining references.Now I have a clear picture of what the PR removes. Let me search the codebase for any remaining references to disqus, field_allow_comments, cgov_disqus, DisqusComments, and blog-comment-policy that might have been missed.Now let me also search for the field_blog_series_shortname field since the DisqusComments.php block used it, and for any JavaScript references related to Disqus/comments:Now let me also check if the field_blog_series_shortname field and its related configs/form displays should also be cleaned up, and look for any test files or Gherkin/Behat tests referencing Disqus or field_allow_comments.Now let me check if the field_blog_series_shortname field and its related configs should also be removed, and check for any tests related to Disqus:Now I have a comprehensive understanding of the PR and the codebase. Let me also check if the field_blog_series_shortname is used in the cgov_blog.module for non-Disqus purposes (URL routing) and look for any test files.Now let me check whether field_blog_series_shortname is used by cgov_blog.module for the URL routing (the loadByProperties call I saw), as well as check if there are any test files:Now I have a comprehensive picture of what the PR has done and what might still be missing. Let me compile my findings.

PR Review: Missing Files for Disqus Removal

I've thoroughly searched the codebase for all references to the Disqus-related items being removed in this PR. Here's what I found:

✅ What the PR Already Covers (Good!)

The PR correctly removes/updates:

  1. DisqusComments.php — The block plugin class (deleted)
  2. block--cgov-disqus.html.twig — Both in cgov_common and ncids_trans themes (deleted)
  3. field.field.node.cgov_blog_series.field_allow_comments.yml — Field config (deleted)
  4. field.storage.node.field_allow_comments.yml — Field storage config (deleted)
  5. All entity view display configs — Removed field_allow_comments references from form displays and view displays across all view modes
  6. YAML content files — Removed field_allow_comments from test content
  7. Blog post full view display — Removed the cgov_disqus block placement
  8. phpstan.neon — Removed the DisqusComments.php exclusion
  9. cgov_blog.install — Added cgov_blog_update_10001() to programmatically remove the field and purge data

⚠️ Potentially Missing Files / Updates

Here are files that still contain Disqus/comment-related references that may need to be addressed:


1. field_blog_series_shortname field description (should update)

description: 'Used to pull down the Disqus URL for a given blog post. Cannot include spaces. Use hyphens between words.'

The description field still references Disqus. Since Disqus is being removed, this description should be updated to reflect the new/remaining purpose of the shortname field (it's still used in cgov_blog.module for converting shortname-to-NID in view contextual filters at line 137-148), so the field itself should stay but the description should be updated.


2. SCSS files with .blog-comment-policy styles (should clean up)

These files contain CSS for .blog-comment-policy, which was only used in the now-deleted block--cgov-disqus.html.twig template:

  • docroot/profiles/custom/cgov_site/themes/custom/cgov/src/styles/_blogs.scss (lines 14-18) — Contains .blog-comment-policy { display: none; } with a comment referencing #cgvCommentsSl and all.js

  • docroot/profiles/custom/cgov_site/themes/custom/cgov/src/styles/_hacks.scss (lines 63-71) — Contains a duplicate .blog-comment-policy { display: none; } rule with extensive comments about comment policy and Disqus

  • docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/front-end/src/legacy/styles/_blogs.scss (lines 58-62) — Same .blog-comment-policy rule in the ncids_trans theme


3. SCSS files with Disqus-related comments (nice to clean up)

The same _blogs.scss files in both themes contain a TODO comment referencing Disqus:

		// @TODO: Remove once IntenseDebate has been correctly implemented to replace Disqus
		.blog-list & {
			display: none;
		}

This appears in both:

  • docroot/profiles/custom/cgov_site/themes/custom/cgov/src/styles/_blogs.scss
  • docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/front-end/src/legacy/styles/_blogs.scss

Summary Table

Priority File Issue
Medium config/install/field.field.node.cgov_blog_series.field_blog_series_shortname.yml description still references "Disqus URL" — should update to reflect current usage
Low themes/custom/cgov/src/styles/_blogs.scss .blog-comment-policy style is now dead code
Low themes/custom/cgov/src/styles/_hacks.scss .blog-comment-policy style + Disqus comments are dead code
Low themes/custom/ncids_trans/front-end/src/legacy/styles/_blogs.scss .blog-comment-policy style is now dead code
Low Both _blogs.scss files @TODO comment referencing Disqus/IntenseDebate replacement

The field_blog_series_shortname description update is probably the most important since it would be misleading to editors. The SCSS cleanups are lower priority but would be good housekeeping.

Note: Search results are limited, so there may be additional references. You can verify with a full code search for "disqus" in the repo and for "blog-comment-policy".

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes all remaining Disqus integration from the CGov Digital Platform’s blog feature set, including the Disqus block plugin, theme templates, and related configuration/content references, and adds an update hook to roll the config changes into existing sites.

Changes:

  • Delete the cgov_disqus block plugin and Disqus Twig templates from both blog themes.
  • Remove the “allow comments” field/config references used to control Disqus on blog series/posts.
  • Add a cgov_blog update hook to import updated feature configs and remove/purge the legacy comments field.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
phpstan.neon Removes PHPStan exclusion entry for the deleted Disqus block plugin.
docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/templates/content/blog/block--cgov-disqus.html.twig Deletes Disqus block theme template (ncids_trans).
docroot/profiles/custom/cgov_site/themes/custom/cgov/cgov_common/templates/content/blog/block--cgov-disqus.html.twig Deletes Disqus block theme template (cgov_common).
docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/content/06400_blog-post-cc.content.yml Removes field_allow_comments values from YAML content.
docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/content/06200_blog-series.content.yml Removes field_allow_comments values from YAML content.
docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/content/06100_blog-series-rssfeed.content.yml Removes field_allow_comments values from YAML content.
docroot/profiles/custom/cgov_site/modules/custom/cgov_core/src/Plugin/Block/DisqusComments.php Deletes the Disqus block plugin implementation (cgov_disqus).
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/field.storage.node.field_allow_comments.yml Removes the field storage config for field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/field.field.node.cgov_blog_series.field_allow_comments.yml Removes the blog series field instance config for field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.thumbnail_card_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.panoramic_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_promo_block_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_list_item_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_flag_card_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.ncids_feature_card_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.lb_primary_content.yml Removes the field component for field_allow_comments from the view display.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.full.yml Removes the field component for field_allow_comments from the view display.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.feature_card_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.embedded_feature_card_no_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.embedded_feature_card.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.default.yml Removes the field component for field_allow_comments from the default view display.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_series.borderless_card_image.yml Removes display dependencies/hidden settings tied to field_allow_comments.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_view_display.node.cgov_blog_post.full.yml Removes the layout-builder Disqus block placement from blog post full view mode.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/config/install/core.entity_form_display.node.cgov_blog_series.default.yml Removes field_allow_comments from the blog series edit form display config.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/cgov_blog.install Adds update hook to import feature config and delete/purge the legacy comments field.
docroot/profiles/custom/cgov_site/modules/custom/cgov_blog/cgov_blog.info.yml Updates Drupal core version requirement.
Comments suppressed due to low confidence (2)

docroot/profiles/custom/cgov_site/themes/custom/cgov/cgov_common/templates/content/blog/block--cgov-disqus.html.twig:1

  • This template previously set s.src = "{{ content }}" inside a <script> block without escaping content for JavaScript context, which allowed injection of arbitrary JS if content contained double quotes or other control characters. Because content ultimately came from the field_blog_series_shortname text field on the blog series node, an editor could craft a value like ";alert(1);// to break out of the string and execute script in visitors' browsers. Removing this template and the associated Disqus block eliminates this injection point; if similar functionality is reintroduced, ensure untrusted values are escaped for JS context (e.g., via a Twig JS-escape filter) rather than concatenated directly into script code.
    docroot/profiles/custom/cgov_site/themes/custom/ncids_trans/templates/content/blog/block--cgov-disqus.html.twig:1
  • This template previously set s.src = "{{ content }}" inside a <script> block without escaping content for JavaScript context, which allowed injection of arbitrary JS if content contained double quotes or other control characters. Because content ultimately came from the field_blog_series_shortname text field on the blog series node, an editor could craft a value like ";alert(1);// to break out of the string and execute script in visitors' browsers. Removing this template and the associated Disqus block eliminates this injection point; if similar functionality is reintroduced, ensure untrusted values are escaped for JS context (e.g., via a Twig JS-escape filter) rather than concatenated directly into script code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +86 to +89
\Drupal::service('field.purge')->purgeBatch(50);
}
else {
field_purge_batch(50);
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

cgov_blog_update_10001() purges only a single batch (50) of field data. On sites with more than 50 items queued for deletion, field_allow_comments data/tables may remain partially purged after the update runs. Consider looping until the purge call returns 0 (or explicitly documenting that follow-up cron/drush runs are required) to ensure the field is fully removed.

Suggested change
\Drupal::service('field.purge')->purgeBatch(50);
}
else {
field_purge_batch(50);
// Continue purging in batches of 50 until there is nothing left to purge.
do {
$purged_count = \Drupal::service('field.purge')->purgeBatch(50);
} while ($purged_count > 0);
}
else {
// Fallback for environments without the field.purge service.
if (function_exists('field_purge_batch')) {
do {
$purged_count = field_purge_batch(50);
} while ($purged_count > 0);
}

Copilot uses AI. Check for mistakes.
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.

This comment was last week so I'm assuming it's junk, but just wanted to double check :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change makes sense as currently, the update hook is purging 50 items at once, and Copilots revision continues to loop until all data is purged. Curious however as this update hook is very similar to what we have for #5132 but copilot didn't complain about that update hook. Testing these changes locally now - should be able to push soon.

@KateMashkinaNIH
Copy link
Copy Markdown

passes testing on test-acsf

@dev-rana-publicis dev-rana-publicis force-pushed the ticket/4684-remove-disqus branch 2 times, most recently from f334092 to 0c455d6 Compare March 2, 2026 17:08
Copy link
Copy Markdown
Member

@bryanpizzillo bryanpizzillo left a comment

Choose a reason for hiding this comment

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

I have some questions regarding the cache context items below... That code seems to have been added last year as part of fixing #4568.

@dev-rana-publicis dev-rana-publicis force-pushed the ticket/4684-remove-disqus branch from 0c455d6 to 38da2e8 Compare March 3, 2026 18:30
@bryanpizzillo
Copy link
Copy Markdown
Member

GH PRs are very unhappy right now. I clicked the rebase and merge and the development branch shows:
image

SO DO NOT REBASE THIS ANDS ATTEMPT TO MERGE.

@andyvanavery31
Copy link
Copy Markdown

GitHub was acting up, and this is a part of the code base and has been merged, despite this appearing as not being merged.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[R4.3] CR: Completely Remove Disqus from the Digital Platform

10 participants