Skip to content

Commit

Permalink
Clean up sitemap.xml and robots.txt implementation
Browse files Browse the repository at this point in the history
I forked https://github.com/nasa-gcn/remix-seo from
https://github.com/balavishnuvj/remix-seo because the latter may
be abandoned.

This PR eliminates the overriden Remix server entry point
(`entry.server.tsx`) and instead has ordinary resource route
modules for the robots.txt and sitemap.xml files.

See also balavishnuvj/remix-seo#14
  • Loading branch information
lpsinger committed Sep 19, 2023
1 parent 3b53bd3 commit 2ecee53
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 214 deletions.
142 changes: 0 additions & 142 deletions app/entry.server.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions app/otherRootRoutes.server.ts

This file was deleted.

2 changes: 1 addition & 1 deletion app/routes/$.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { LoaderFunction } from '@remix-run/node'

import type { BreadcrumbHandle } from '~/root/Title'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth.post_logout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import { type LoaderFunctionArgs, redirect } from '@remix-run/node'
import { Form, Link, useLoaderData } from '@remix-run/react'
import {
Expand Down
17 changes: 17 additions & 0 deletions app/routes/_seo.robots[.]txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!
* Copyright © 2023 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
import { generateRobotsTxt } from '@nasa-gcn/remix-seo'

import { origin } from '~/lib/env.server'

export function loader() {
return generateRobotsTxt([
{ type: 'sitemap', value: `${origin}/sitemap.xml` },
{ type: 'disallow', value: '/user' },
])
}
21 changes: 21 additions & 0 deletions app/routes/_seo.sitemap[.]xml.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* Copyright © 2023 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
import { generateSitemap } from '@nasa-gcn/remix-seo'
import { routes } from '@remix-run/dev/server-build'
import type { LoaderFunctionArgs } from '@remix-run/node'

import { origin } from '~/lib/env.server'

export function loader({ request }: LoaderFunctionArgs) {
return generateSitemap(request, routes, {
siteUrl: origin,
headers: {
'Cache-Control': `public, max-age=${60 * 5}`,
},
})
}
2 changes: 1 addition & 1 deletion app/routes/quickstart.alerts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import { Form, Link, useSearchParams } from '@remix-run/react'
import { Button, ButtonGroup, FormGroup, Label } from '@trussworks/react-uswds'
import { useState } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/quickstart.code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { Form, Link, useLoaderData } from '@remix-run/react'
import { Button, ButtonGroup, FormGroup } from '@trussworks/react-uswds'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/quickstart.credentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'

Expand Down
2 changes: 1 addition & 1 deletion app/routes/unsubscribe.$jwt/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import {
Form,
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { UpdateUserAttributesCommand } from '@aws-sdk/client-cognito-identity-provider'
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { useFetcher, useLoaderData } from '@remix-run/react'
import {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.credentials._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData } from '@remix-run/react'

Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.credentials.edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'

import {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.credentials/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'

import type { BreadcrumbHandle } from '~/root/Title'

Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.email._index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { Link, useFetcher, useLoaderData } from '@remix-run/react'
import { Button, ButtonGroup, Grid, Icon } from '@trussworks/react-uswds'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.email.edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { redirect } from '@remix-run/node'
import { Form, Link, useLoaderData } from '@remix-run/react'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.email/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'

import type { BreadcrumbHandle } from '~/root/Title'

Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.endorsements/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { Link, useFetcher, useLoaderData } from '@remix-run/react'
import {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.password/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import type { DataFunctionArgs } from '@remix-run/node'
import { useFetcher } from '@remix-run/react'
import {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import type { SEOHandle } from '@balavishnuvj/remix-seo'
import type { SEOHandle } from '@nasa-gcn/remix-seo'
import { NavLink, Outlet } from '@remix-run/react'
import { GridContainer } from '@trussworks/react-uswds'

Expand Down
Loading

0 comments on commit 2ecee53

Please sign in to comment.