question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with "::first-letter (:first-letter)": (Google search result header does not show properly for pseudo-classes)

See original GitHub issue

MDN URL: https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter

What information was incorrect, unhelpful, or incomplete?

When we search for any pseudo-class on Google, It ignores some of the first keywords while showing MDN in the results list.

Specific section or headline?

image For instance, the result should show something like ::before (:before) - CSS: Cascading Style Sheets - MDN Web Docs. But instead, it ignores “::before (:” part in the results.

What did you expect to see?

Some result header like ::before (:before) - CSS: Cascading Style Sheets - MDN Web Docs should show in the results. It seems to be some issue in SEO.

Did you test this? If so, how?

Checked on different search Engines by searching the same text “css before”. Search engines tested on:

  1. Google: failed
  2. Duckduckgo: passed
  3. Dogpile: passed
  4. Yandex: passed (shows before instead of ::before)
MDN Content page report details

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ddbeckcommented, Nov 17, 2021

I’m guessing this is Google rewriting page titles. It appears that Google is stripping out the colons. I’d guess there’s some strategy here to strip needless separators from titles, which has swallowed actual content here.

Reading their docs, I’m not sure we can do anything about this. It sounds like the biggest thing we might be able to do would be to shorten the title so that there’s less incentive for Google to trim it, though I don’t know if that’s particularly desirable for readers.

I’ve tagged this as help wanted. If someone knows a bit more about SEO, I’d welcome some more concrete (and substantiated by evidence) suggestions for avoiding this.

1reaction
tannerdolbycommented, Nov 25, 2021

Spun up a small demo at https://tannerdolby.com/seo-demo, once its been indexed by Google, having a look at SEO results in the browser should display the <title>: ... content now that we are using a character entity to represent colon like <title>&lt;title&gt;&colon;</title> where the colon shouldn’t get recognized as a separator. If anyone can manage to get the page displayed in SEO results, do share a screenshot so we all can see.

If we can’t find a way to use an HTML entity to represent the : in <title>'s, then the issue will persist. Where the last resort would be removing the colon as a separator in titles where it would be <title> The Document Title Element instead of <title>: The Document Title Element which I do think looks more readable with the colon but if it continues to cause problems for Chrome could be an option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

first-letter - CSS: Cascading Style Sheets - MDN Web Docs
The ::first-letter CSS pseudo-element applies styles to the first letter of the first line of a block-level element, but only when not ......
Read more >
CSS :first-letter not working - Stack Overflow
The ::first-letter CSS pseudo-element selects the first letter of the first line of a block, if it is not preceded by any other...
Read more >
linkedin-skill-assessments-quizzes/css-quiz.md at main - GitHub
Using the :nth-child pseudo class, what would be the most efficient way to style every third item in a list, no matter how...
Read more >
text containing first-letter CSS style can't be selected/searched
1. Select the text containing first letter styled with first-letter CSS. ("Přijeďte" in the first paragraph, in this case). ... What is the...
Read more >
CSS/Selectors/pseudo-elements/:first-letter - W3C Wiki
The ::first-letter pseudo-element represents the first letter of an element, if it is not preceded by any other content (such as images or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found