Simplify print style for links with URL text - #8848
Merged
Merged
Conversation
chosak
commented
Jun 25, 2025
| @@ -34,7 +34,7 @@ | |||
| a.m-info-unit__heading-link::after, | |||
chosak
force-pushed
the
feature/cleaner-print-links
branch
from
June 25, 2025 17:59
443379f to
ae66b37
Compare
Currently the site print style marks up links with their URL, for example, given a link with text "Example" that points to example.com, the link will render like Example (example.com) This is overly verbose in cases where the link text is actually the same as the URL, in which case you get duplication, like example.com/foo (https://example.com/foo) This commit attempts to modify this markup logic to avoid this duplication, while keeping existing behavior for all other links. This is implemented by adding a new class on the backend to links with URL link text, and having our frontend CSS hide the URL markup if that class exists. It isn't possible to implement this logic in CSS alone. The backend logic attempts to be smart; for example, a link to https://www.consumerfinance.gov/foo that has link text of "consumerfinance.gov/foo" will still get the simplified styling. See internal DeCo#641 for context.
chosak
force-pushed
the
feature/cleaner-print-links
branch
from
June 25, 2025 18:11
ae66b37 to
bf5a764
Compare
anselmbradford
approved these changes
Jul 8, 2025
chosak
marked this pull request as ready for review
July 8, 2025 15:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Currently the site print style marks up links with their URL, for example, given a link with text "Example" that points to example.com, the link will render like
Example (example.com)
This is overly verbose in cases where the link text is actually the same as the URL, in which case you get duplication, like
example.com/foo (https://example.com/foo)
This commit attempts to modify this markup logic to avoid this duplication, while keeping existing behavior for all other links.
This is implemented by adding a new class on the backend to links with URL link text, and having our frontend CSS hide the URL markup if that class exists. It isn't possible to implement this logic in CSS alone.
The backend logic attempts to be smart; for example, a link to https://www.consumerfinance.gov/foo that has link text of "consumerfinance.gov/foo" will still get the simplified styling.
See internal DeCo#641 for context.
Notes and todos
@anselmbradford I'm opening this as a draft as it needs some frontend love and content review. Please feel free to modify the class that gets applied, and also please audit this on the pages you're tracking with this issue to ensure it only applies where desired.