Skip to content

Commit

Permalink
SEO optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Flammae committed Dec 8, 2023
1 parent 8426406 commit 820b22f
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 10 deletions.
39 changes: 39 additions & 0 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ patterns in React.

## What is `react-slots` for

**The slot pattern enables you to break down parent-provided content into
multiple parts and instruct a component on where to render each part by placing
slots.**

The slot pattern works best for utility components within your design system.
These components don't depend on any specific shape of data and work with
primitives as much as possible. You can think of `react-slots` as a way to
Expand Down Expand Up @@ -691,3 +695,38 @@ Checkout
If you like this project please show support by starring it on
[Github](https://github.com/Flammae/react-slots)
</Callout>

```tsx
type Props = {
// a function that renders content or just content;
summary: SlotProp;
// a function that receives isOpen and returns content or just content;
icon: SlotProp<{ isOpen: boolean }>;
// ... same as before
children: SlotChildren<Slot<{ isOpen: boolean }>>;
};
function Accordion(props: Props) {
const { slot } = useSlot({
summary: props.summary,
icon: props.icon,
children: props.children,
});
return (
<div>
<h1>
<slot.summary />
<slot.icon isOpen={true} />
</h1>
<h1>
<slot.default isOpen={true} />
</h1>
</div>
);
}
<Accordion summary="summary" icon={"<"}>
content
</Accordion>;
```
Binary file added docs/public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions docs/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "beqa/react-slots",
"short_name": "React Slots",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
49 changes: 39 additions & 10 deletions docs/theme.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,51 @@ const config: DocsThemeConfig = {
docsRepositoryBase: "https://github.com/Flammae/react-slots/tree/main/docs",
head: () => {
return (
<link
rel="icon"
type="image/x-icon"
href="logo-sm-black-white.png"
></link>
<>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<link rel="manifest" href="/site.webmanifest" />
</>
);
},

useNextSeoProps() {
const { asPath } = useRouter();
console.log("asPath", asPath);
if (asPath !== "/") {
return {
titleTemplate: "%s – @beqa/react-slots",
};
}

let titleTemplate =
asPath === "/"
? "%s"
: asPath.startsWith("/tutorial")
? "%s – Tutorial – beqa/react-slots"
: asPath.startsWith("/advanced")
? "%s – Advanced Use – beqa/react-slots"
: "%s – beqa/react-slots";

return {
defaultTitle: "beqa/react-slots",
titleTemplate,
description:
asPath === "/"
? "beqa/react-slots is the most feature-complete slot implementation in React. It enables you to break down parent-provided content into multiple parts and instruct a component on where to render each part by placing slots."
: undefined,
canonical: "https://slots.beqa.site",
};
},
};

Expand Down

1 comment on commit 820b22f

@vercel
Copy link

@vercel vercel bot commented on 820b22f Dec 8, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

react-slots-docs – ./docs

react-slots-docs-beqa.vercel.app
react-slots-docs.vercel.app
react-slots-docs-git-main-beqa.vercel.app
slots.beqa.site

Please sign in to comment.