Skip to content

Commit

Permalink
docs: improve search 1/ (#8229)
Browse files Browse the repository at this point in the history
* docs: improve search 1/

* fix indentation in left nav
  • Loading branch information
yuhan committed Jun 7, 2022
1 parent 148e3e5 commit 8cc09fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
16 changes: 9 additions & 7 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"stop_urls": [
"https://docs.dagster.io/_modules/",
"https://docs.dagster.io/master/",
"https://docs.dagster.io/\\d+\\.\\d+.\\d+/"
"https://docs.dagster.io/\\d+\\.\\d+.\\d+/",
"https://docs.dagster.io/changelog",
"https://docs.dagster.io/migration"
],
"strip_chars": " .,;:#¶",
"selectors": {
Expand Down Expand Up @@ -41,12 +43,12 @@
"selector": "",
"default_value": "API"
},
"lvl1": ".section h1",
"lvl2": ".section h2",
"lvl3": ".section h3",
"lvl4": ".section h4",
"lvl5": ".section h5, .section .rubric, .section dt",
"text": ".section p, .section li"
"lvl1": "section h1",
"lvl2": "section h2",
"lvl3": "section h3",
"lvl4": "section h4",
"lvl5": "section h5, section .rubric, section dt",
"text": "section p, section li"
}
},
"nb_hits": 9458
Expand Down
10 changes: 6 additions & 4 deletions docs/next/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const MenuItem = React.forwardRef<
{
"hover:bg-lavender hover:bg-opacity-50 text-blurple": match,
"hover:text-gray-900 hover:bg-lavender hover:bg-opacity-50": !match,
"py-2": lvl <= 2,
"px-2": lvl === 0,
"pl-3 pr-2": lvl === 2,
"pl-3 pr-2": lvl <= 1,
"py-2": lvl <= 2,
}
)}
href={href}
Expand All @@ -66,7 +66,9 @@ const MenuItem = React.forwardRef<
)}
<span
className={cx({
// Map content hierarchy to levels for docs search
"DocSearch-lvl0": lvl === 0 && match,
"DocSearch-lvl1": lvl === 1 && match,
"DocSearch-lvl2": lvl === 2 && match,
})}
>
Expand Down Expand Up @@ -161,11 +163,11 @@ const SecondaryNavigation = () => {
href={itemWithPath.path}
item={sectionOrItem}
match={match}
lvl={2}
lvl={1}
/>
) : (
<Link href={itemWithPath.path} passHref>
<MenuItem item={sectionOrItem} match={match} lvl={2} />
<MenuItem item={sectionOrItem} match={match} lvl={1} />
</Link>
)}
{match && sectionOrItem.children && (
Expand Down
5 changes: 2 additions & 3 deletions docs/next/pages/sitemap.xml.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { latestAllPaths } from "util/useNavigation";
import { latestAllVersionedPaths } from "util/useNavigation";

const toUrl = (host, route) => `<url><loc>http://${host}${route}</loc></url>`;

Expand All @@ -11,10 +11,9 @@ const createSitemap = (host, routes) =>
const Sitemap = () => {};

Sitemap.getInitialProps = ({ res, req }) => {
const routes = latestAllPaths().map(
const routes = latestAllVersionedPaths().map(
({ params }) => "/" + params.page.join("/")
);
console.log(routes);
const sitemap = createSitemap(req.headers.host, routes);

res.setHeader("Content-Type", "text/xml");
Expand Down

1 comment on commit 8cc09fe

@vercel
Copy link

@vercel vercel bot commented on 8cc09fe Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.