Skip to content

Commit

Permalink
Fix IDs on widget catalog pages (#10995)
Browse files Browse the repository at this point in the history
Since these are header elements, we should make sure their IDs can be
properly used as a URI fragment by using the same slugify function as
elsewhere on the site.
  • Loading branch information
parlough authored Aug 5, 2024
1 parent e0d2ff0 commit eaba9da
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/_11ty/filters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getPageInfo } from './utils/get-page-info.js';
import { slugify } from "./utils/slugify.js";
import { fromHtml } from 'hast-util-from-html';
import { selectAll } from 'hast-util-select';
import { toText } from 'hast-util-to-text';
Expand Down Expand Up @@ -27,6 +28,7 @@ export function registerFilters(eleventyConfig) {
eleventyConfig.addFilter('array_to_sentence_string', arrayToSentenceString);
eleventyConfig.addFilter('generate_toc', generateToc);
eleventyConfig.addFilter('breadcrumbsForPage', breadcrumbsForPage);
eleventyConfig.addFilter('slugify', slugify);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/docs/catalogpage-material.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% if category.subcategories and category.subcategories.size != 0 -%}
<ul>
{% for sub in category.subcategories -%}
<li><a href="#{{sub.name}}">{{sub.name}}</a></li>
<li><a href="#{{sub.name | slugify}}">{{sub.name}}</a></li>
{% endfor -%}
</ul>
{% endif -%}
Expand All @@ -20,7 +20,7 @@
{% for sub in category.subcategories -%}
{% assign components = catalog.widgets | widget_filter: "subcategories", sub.name %}
{% if components.size != 0 -%}
<h2 id="{{sub.name}}">{{sub.name}}</h2>
<h2 id="{{sub.name | slugify}}">{{sub.name}}</h2>
<div class="card-grid">
{% for comp in components -%}
<div class="card">
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/docs/catalogpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% if category.subcategories and category.subcategories.size != 0 -%}
<ul>
{% for sub in category.subcategories -%}
<li><a href="#{{sub.name}}">{{sub.name}}</a></li>
<li><a href="#{{sub.name | slugify}}">{{sub.name}}</a></li>
{% endfor -%}
</ul>
{% endif -%}
Expand Down Expand Up @@ -47,7 +47,7 @@
{% for sub in category.subcategories -%}
{% assign components = catalog.widgets | widget_filter: "subcategories", sub.name %}
{% if components.size != 0 -%}
<h2 id="{{sub.name}}">{{sub.name}}</h2>
<h2 id="{{sub.name | slugify}}">{{sub.name}}</h2>
<div class="card-grid">
{% for comp in components -%}
<div class="card">
Expand Down
2 changes: 1 addition & 1 deletion src/content/ui/layout/scrolling/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ For more information, check out
and the [Sliver classes][].

[`CustomScrollView`]: {{site.api}}/flutter/widgets/CustomScrollView-class.html
[Sliver classes]: /ui/widgets/layout#Sliver%20widgets
[Sliver classes]: /ui/widgets/layout#sliver-widgets
[Using slivers to achieve fancy scrolling]: /ui/layout/scrolling/slivers

## Nested scrolling widgets
Expand Down

0 comments on commit eaba9da

Please sign in to comment.