Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add robots.txt #68

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# next.js
/.next/
/out/
next-env.d.ts

# production
/build
Expand All @@ -24,6 +25,8 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
logs
*.log

# local env files
.env.local
Expand All @@ -38,3 +41,7 @@ yarn-error.log*
.faust
globalStylesheet.css
possibleTypes.json

## Build artifacts for sitemaps
/public/sitemap*.xml
/public/robots.txt
2 changes: 1 addition & 1 deletion components/Callout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function Callout({ type = 'note', title, children }) {

return (
<div className={clsx('my-8 flex rounded-3xl p-6', styles[type].container)}>
<IconComponent className="h-8 w-8 flex-none" />
<IconComponent className="size-8 flex-none" />
<div className="ml-4 flex-auto">
<p className={clsx('m-0 font-display text-xl', styles[type].title)}>
{title}
Expand Down
4 changes: 2 additions & 2 deletions components/DocsSidebarNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function DocsSidebarNavigation({ className, data, navigation }) {
if (!currentNode) {
return false;
}

return section.links.some(link => link.href.includes(currentNode.uri));
};

Expand Down Expand Up @@ -61,7 +61,7 @@ export function DocsSidebarNavigation({ className, data, navigation }) {
>
<svg
className={clsx(
'h-4 w-4 transition-transform',
'size-4 transition-transform',
expandedSections[section.title] && 'rotate-180'
)}
xmlns="http://www.w3.org/2000/svg"
Expand Down
4 changes: 2 additions & 2 deletions components/MobileNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function MobileNavigation({ navigation }) {
className="relative"
aria-label="Open navigation"
>
<MenuIcon className="h-6 w-6 stroke-slate-500" />
<MenuIcon className="size-6 stroke-slate-500" />
</button>
<Dialog
open={isOpen}
Expand All @@ -79,7 +79,7 @@ export function MobileNavigation({ navigation }) {
onClick={() => setIsOpen(false)}
aria-label="Close navigation"
>
<CloseIcon className="h-6 w-6 stroke-slate-500" />
<CloseIcon className="size-6 stroke-slate-500" />
</button>
<Link href="/" className="ml-6" aria-label="Home page">
<Logo className="h-auto w-9" />
Expand Down
2 changes: 1 addition & 1 deletion components/PrimaryNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function PrimaryNavigation({ navigation }) {
<li className="row-span-3" key={sublink.id}>
<NavigationMenuLink asChild>
<Link
className="flex h-full w-full select-none flex-col justify-end rounded-md bg-gradient-to-b from-muted/50 to-muted p-6 no-underline outline-none focus:shadow-md"
className="flex size-full select-none flex-col justify-end rounded-md bg-gradient-to-b from-muted/50 to-muted p-6 no-underline outline-none focus:shadow-md"
href={sublink.href}
target={sublink?.target ?? null}
>
Expand Down
2 changes: 1 addition & 1 deletion components/QuickLinks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function QuickLink({ title, description, href, icon }) {
<div className="group relative rounded-xl border border-slate-200 dark:border-slate-800">
<div className="absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.indigo.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 dark:[--quick-links-hover-bg:theme(colors.slate.800)]" />
<div className="relative overflow-hidden rounded-xl p-6">
<Icon icon={icon} className="h-8 w-8" />
<Icon icon={icon} className="size-8" />
<h2 className="mt-4 font-display text-base text-slate-900 dark:text-white">
<Link href={href}>
<span className="absolute -inset-px rounded-xl" />
Expand Down
4 changes: 2 additions & 2 deletions components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ export function Search({ ...props }) {

return (
<button
className="group flex h-6 w-6 items-center justify-center sm:justify-start md:h-auto md:w-80 md:flex-none md:rounded-lg md:py-2.5 md:pl-4 md:pr-3.5 md:text-sm md:ring-1 md:ring-slate-200 md:hover:ring-slate-300 dark:md:bg-slate-800/75 dark:md:ring-inset dark:md:ring-white/5 dark:md:hover:bg-slate-700/40 dark:md:hover:ring-slate-500 lg:w-96"
className="group flex size-6 items-center justify-center sm:justify-start md:h-auto md:w-80 md:flex-none md:rounded-lg md:py-2.5 md:pl-4 md:pr-3.5 md:text-sm md:ring-1 md:ring-slate-200 md:hover:ring-slate-300 dark:md:bg-slate-800/75 dark:md:ring-inset dark:md:ring-white/5 dark:md:hover:bg-slate-700/40 dark:md:hover:ring-slate-500 lg:w-96"
type="button"
ref={searchButtonRef}
onClick={onOpen}
{...props}
>
<SearchIcon className="h-5 w-5 flex-none fill-slate-400 group-hover:fill-slate-500 dark:fill-slate-500 md:group-hover:fill-slate-400" />
<SearchIcon className="size-5 flex-none fill-slate-400 group-hover:fill-slate-500 dark:fill-slate-500 md:group-hover:fill-slate-400" />
<span className="sr-only md:not-sr-only md:ml-2 md:text-slate-500 md:dark:text-slate-400">
Search docs
</span>
Expand Down
4 changes: 2 additions & 2 deletions components/SiteHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ export function SiteHeader({ navigation, isNoticeVisible = false }) {
className="group"
aria-label="GitHub"
>
<GitHubIcon className="h-6 w-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300" />
<GitHubIcon className="size-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300" />
</Link>
<Link
href="https://github.com/wp-graphql/wpgraphql-acf"
className="group"
aria-label="GitHub"
>
<WordPressIcon className="h-6 w-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300" />
<WordPressIcon className="size-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300" />
</Link>
</div>
</header>
Expand Down
14 changes: 7 additions & 7 deletions components/ThemeSelector.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
"use client"

import { MoonIcon, SunIcon } from "@radix-ui/react-icons"
import { useTheme } from "next-themes"
import * as React from "react"

import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

export function ModeToggle() {
const { setTheme } = useTheme()

return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="icon">
<SunIcon className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<MoonIcon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<SunIcon className="size-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<MoonIcon className="absolute size-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<span className="sr-only">Toggle theme</span>
</Button>
</DropdownMenuTrigger>
Expand All @@ -37,4 +37,4 @@ export function ModeToggle() {
</DropdownMenuContent>
</DropdownMenu>
)
}
}
2 changes: 1 addition & 1 deletion components/ui/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const AccordionTrigger = React.forwardRef<
{...props}
>
{children}
<ChevronDownIcon className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
<ChevronDownIcon className="size-4 shrink-0 text-muted-foreground transition-transform duration-200" />
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
))
Expand Down
10 changes: 5 additions & 5 deletions components/ui/context-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ..
)}
{...props}>
{children}
<ChevronRight className="ml-auto h-4 w-4" />
<ChevronRight className="ml-auto size-4" />
</ContextMenuPrimitive.SubTrigger>
))
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
Expand Down Expand Up @@ -76,9 +76,9 @@ const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked
)}
checked={checked}
{...props}>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span className="absolute left-2 flex size-3.5 items-center justify-center">
<ContextMenuPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
<Check className="size-4" />
</ContextMenuPrimitive.ItemIndicator>
</span>
{children}
Expand All @@ -95,9 +95,9 @@ const ContextMenuRadioItem = React.forwardRef(({ className, children, ...props }
className
)}
{...props}>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span className="absolute left-2 flex size-3.5 items-center justify-center">
<ContextMenuPrimitive.ItemIndicator>
<Circle className="h-2 w-2 fill-current" />
<Circle className="size-2 fill-current" />
</ContextMenuPrimitive.ItemIndicator>
</span>
{children}
Expand Down
10 changes: 5 additions & 5 deletions components/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
{...props}
>
{children}
<ChevronRightIcon className="ml-auto h-4 w-4" />
<ChevronRightIcon className="ml-auto size-4" />
</DropdownMenuPrimitive.SubTrigger>
))
DropdownMenuSubTrigger.displayName =
Expand Down Expand Up @@ -110,9 +110,9 @@ const DropdownMenuCheckboxItem = React.forwardRef<
checked={checked}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span className="absolute left-2 flex size-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<CheckIcon className="h-4 w-4" />
<CheckIcon className="size-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
Expand All @@ -133,9 +133,9 @@ const DropdownMenuRadioItem = React.forwardRef<
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span className="absolute left-2 flex size-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<DotFilledIcon className="h-4 w-4 fill-current" />
<DotFilledIcon className="size-4 fill-current" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
Expand Down
4 changes: 2 additions & 2 deletions components/ui/navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const NavigationMenuTrigger = React.forwardRef<
>
{children}{' '}
<ChevronDown
className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
className="relative top-px ml-1 size-3 transition duration-200 group-data-[state=open]:rotate-180"
aria-hidden="true"
/>
</NavigationMenuPrimitive.Trigger>
Expand Down Expand Up @@ -109,7 +109,7 @@ const NavigationMenuIndicator = React.forwardRef<
)}
{...props}
>
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
<div className="relative top-[60%] size-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
</NavigationMenuPrimitive.Indicator>
))
NavigationMenuIndicator.displayName =
Expand Down
24 changes: 24 additions & 0 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @type {import('next-sitemap').IConfig} */

const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL

module.exports = {
siteUrl: SITE_URL,
generateRobotsTxt: true,
exclude: ["/docs-sitemap.xml", "/docs/*"],
robotsTxtOptions: {
additionalSitemaps: [
`${SITE_URL}/wordpress-sitemap.xml`, // <==== Add here
],
},
transform: (config, path) => {
if (path.match(/\/\d{4}\/\d{2}\/\d{2}\/.*/gim)) {
return null
}

return {
loc: path,
lastmod: config.autoLastmod ? new Date().toISOString() : undefined,
}
},
}
Loading
Loading