Skip to content

Commit

Permalink
feat: add redirect from /docs/[operator] to /operators/[operator]
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeysova committed Aug 31, 2024
1 parent 77f5cb2 commit 9fe1231
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,26 @@
> Note: be careful NOT to commit `babel-plugin-factories.json` with changed library name `@effector/patronum`
When work is done, please remove `@effector/patronum` from integration packages via `pnpm remove @effector/patronum`, else CI can be broken.

## Documentation

All the documentation source code placed in `./documentation`. It is uses [astro](https://astro.build) and [starlight](https://starlight.astro.build) on top of it.

Documentation for operators placed right in the operator directory:

```
./src/
├── and/
│   ├── and.fork.test.ts
│   ├── and.test.ts
│   ├── index.ts
│   └── readme.md
├── combine-events/
│   ├── combine-events.fork.test.ts
│   ├── combine-events.test.ts
│   ├── index.ts
│   └── readme.md
...
```

Documentation uses [Content Layer API](https://docs.astro.build/en/reference/configuration-reference/#querying-and-rendering-with-the-content-layer-api). You may want to [read this discussion](https://github.com/withastro/starlight/discussions/2268).
20 changes: 20 additions & 0 deletions documentation/src/pages/docs/[operator].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
import { getCollection, getEntry, render } from "astro:content";
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
export async function getStaticPaths() {
const operators = await getCollection("operators");
return operators.map((operator) => ({
params: { operator: operator.data.slug },
}));
}
const operator = await getEntry("operators", Astro.params.operator);
---

<meta http-equiv="refresh" content={`0;url=/operators/${operator.data.slug}`} />
<meta name="robots" content="noindex" />
<StarlightPage frontmatter={{...operator.data, pagefind: false}}>
<!-- exclude this page from pagefind indexing -->
<p>Redirecting to <a href="/operators/{operator.data.slug}">/operators/{operator.data.slug}</a></p>
</StarlightPage>

0 comments on commit 9fe1231

Please sign in to comment.