Skip to content

[Markdown] Decide what to do about class="summary" and class="seoSummary" #3923

@wbamberg

Description

@wbamberg

seoSummary and summary are classes that get applied to prose content in MDN pages. They're used to help calculate a thing we'll call a "page summary". The calculation is a bit complicated (https://github.com/mdn/yari/blob/main/kumascript/src/info.js#L202), but in general, it's something like:

  • if span.seoSummary exists in the page, then its content is taken as the page summary
  • otherwise, if any .summary element exists in the page, then its content is taken as the page summary
  • otherwise, the summary is taken from the first p element in the document that does not live in a note or warning div.

So essentially these classes are used to provide a custom page summary, and if they are not given we default to using the first paragraph.

What's the page summary used for?

It's used in (at least) a couple of ways:

How widely are summary and seoSummary used?

Across all en-US, I count:

  • 1322 uses of the summary class
  • 2285 uses of the seoSummary class

Across just JavaScript:

  • 24 uses of the summary class
  • 105 uses of the seoSummary class

How should we handle them in Markdown-land?

The most obvious option is: stop supporting them, and just always use the first non-note paragraph for the page summary. It would be good to know if we would be regressing many pages by doing this.

Many pages just mark up the first paragraph with summary or seoSummary, so removing those classes would have no actual impact. For example:

<p class="summary">Learning some HTML, CSS, and JavaScript is useful if you want to become a web developer. Beyond mechanical use, it's important to learn how to use these technologies <strong>responsibly</strong> so that all readers might use your creations on the web. To help you achieve this, this module will cover general best practices (which are demonstrated throughout the <a href="/en-US/docs/Learn/HTML">HTML</a>, <a href="/en-US/docs/Learn/CSS">CSS</a>, and <a href="/en-US/docs/Learn/JavaScript">JavaScript</a> topics), <a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing">cross browser testing</a>, and some tips on enforcing accessibility from the start. We'll cover accessibility in special detail.</p>

However, some actually do use it to override the default:

<p><span class="seoSummary">This guide introduces the video codecs you're most likely to encounter or consider using on the web, summaries of their capabilities and any compatibility and utility concerns, and advice to help you choose the right codec for your project's video.</span></p>

It would I think be worthwhile to:

  • analyse how many of the thousands of uses of these classes are actually no-ops
  • remove the no-ops
  • make a plan for the remainder.

We should also do an analysis of how KS macros are using the page summary, and whether they would be broken by removing the ability to override the default.

If we did decide it's important to let pages override the "first paragraph rule", we could consider having an optional front matter key for this, and we might also consider whether this is the same as the "short description" that we've talked about before as a component of our pages.

For now, we could limit this exercise to the JavaScript docs.

( @escattone , we talked about this issue yesterday)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions