rustdoc: improve web search snippets #82283
Labels
A-rustdoc-ui
Area: Rustdoc UI (generated HTML)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Boilerplate
Some (but not all) search result snippets for rust items include the boilerplate "1.0.0[−][src]". Example screenshots below are linked to the Google search results page they are taken from.
Search results for "rust slice" show the boilerplate:
Search results for "rust slice" omit the boilerplate:
Per https://developers.google.com/search/docs/advanced/appearance/good-titles-snippets and https://developers.google.com/search/docs/advanced/crawling/special-tags#data-nosnippet, we can wrap this particular piece of boilerplate in
<span data-nosnippet>
to omit it from snippets.Low-information meta descriptions
Also, search engines commonly make snippets from the
<meta name="description" value="...">
tag. The tag rustdoc currently generates is very low-information. For instance:It would be much better to fill this tag with the first sentence (or two) of actual documentation. For instance:
The text was updated successfully, but these errors were encountered: