Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
name: cypress-screenshots-broken-links
path: cypress/screenshots

test-a11y:
Expand All @@ -75,7 +75,7 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
name: cypress-screenshots-a11y
path: cypress/screenshots

test-seo:
Expand All @@ -100,5 +100,5 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
name: cypress-screenshots-seo
path: cypress/screenshots
4 changes: 2 additions & 2 deletions cypress/e2e/a11y.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('a11y accessiblity test suite', () => {
cy.viewport('macbook-16')
cy.visit(page)
cy.injectAxe()
cy.wait(500)
cy.wait(100)
cy.checkA11y(
undefined,
{
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('a11y accessiblity test suite', () => {
cy.viewport('iphone-x')
cy.visit(page)
cy.injectAxe()
cy.wait(500)
cy.wait(100)
cy.checkA11y(
undefined,
{
Expand Down
85 changes: 31 additions & 54 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,6 @@ const nextConfig = {
basePath: false,
permanent: true,
})),
...[
'/docs/local-dashboard',
'/docs/installation',
'/docs/deployment',
'/docs/language-support',
'/docs/guides/deploy',
'/docs/guides/github-actions',
].map((source) => ({
source: source,
destination: `/docs/getting-started${source.replace(
/^(\/docs\/guides\/|\/docs\/)/,
'/',
)}`,
basePath: false,
permanent: true,
})),
...['/docs/guides/text-prediction', '/docs/guides/create-histogram'].map(
(source) => ({
source: source,
Expand All @@ -128,7 +112,7 @@ const nextConfig = {
},
{
source: '/docs/assets',
destination: '/docs/concepts/introduction',
destination: '/docs',
basePath: false,
permanent: true,
},
Expand All @@ -140,7 +124,7 @@ const nextConfig = {
},
{
source: '/docs/concepts',
destination: '/docs/concepts/introduction',
destination: '/docs',
basePath: false,
permanent: true,
},
Expand All @@ -164,7 +148,7 @@ const nextConfig = {
},
{
source: '/docs/access-control',
destination: '/docs/concepts/access-control',
destination: '/docs/get-started/foundations/infrastructure/security',
basePath: false,
permanent: true,
},
Expand All @@ -176,25 +160,25 @@ const nextConfig = {
},
{
source: '/docs/getting-started',
destination: '/docs/getting-started/quickstart',
destination: '/docs/get-started/quickstart',
basePath: false,
permanent: true,
},
{
source: '/docs/guides/getting-started',
destination: '/docs/getting-started/quickstart',
destination: '/docs/get-started/quickstart',
basePath: false,
permanent: true,
},
{
source: '/docs/guides/getting-started/concepts',
destination: '/docs/concepts/introduction',
destination: '/docs',
basePath: false,
permanent: true,
},
{
source: '/docs/getting-started/concepts',
destination: '/docs/concepts/introduction',
destination: '/docs',
basePath: false,
permanent: true,
},
Expand All @@ -218,7 +202,7 @@ const nextConfig = {
},
{
source: '/docs/assets/access-control',
destination: '/docs/concepts/access-control',
destination: '/docs/get-started/foundations/infrastructure/security',
basePath: false,
permanent: true,
},
Expand All @@ -236,7 +220,7 @@ const nextConfig = {
},
{
source: '/docs/guides/getting-started/language-support',
destination: '/docs/concepts/language-support',
destination: '/docs/reference/languages#supported-languages',
basePath: false,
permanent: true,
},
Expand Down Expand Up @@ -281,43 +265,36 @@ const nextConfig = {
basePath: false,
permanent: true,
})),
...[
'/docs/guides/getting-started/quickstart',
'/docs/guides/getting-started/installation',
'/docs/guides/getting-started/local-dashboard',
'/docs/guides/getting-started/deployment',
].map((source) => ({
source: source,
destination: `/docs/${source.replace(
/^(\/docs\/guides\/|\/docs\/)/,
'',
)}`,
{
source: '/docs/guides/getting-started/quickstart',
destination: '/docs/get-started/quickstart',
basePath: false,
permanent: true,
})),
},
{
source: '/docs/faq/common-questions',
destination: '/docs/faq',
source: '/docs/guides/getting-started/installation',
destination: '/docs/get-started/installation',
basePath: false,
permanent: true,
},
...[
'aws-cdk',
'aws-sam',
'gcp-deployment-manager',
'bicep',
'pulumi',
'terraform',
'sst',
'encore',
'winglang',
'ampt',
].map((page) => ({
source: `/docs/faq/comparison/${page}`,
destination: `/docs/concepts/comparison/${page}`,
{
source: '/docs/guides/getting-started/local-dashboard',
destination: '/docs/get-started/foundations/projects/local-development',
basePath: false,
permanent: true,
})),
},
{
source: '/docs/guides/getting-started/deployment',
destination: '/docs/get-started/foundations/deployment',
basePath: false,
permanent: true,
},
{
source: '/docs/faq/common-questions',
destination: '/docs/faq',
basePath: false,
permanent: true,
},
{
source: '/docs/reference/pulumi',
destination: '/docs/reference/providers/pulumi',
Expand Down
7 changes: 3 additions & 4 deletions scripts/build-sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ const fs = require('fs/promises')
const excludedDirectories = ['[[...slug]]'] // ignore dynamic routes
const pages = []

const URL = 'https://nitric.io/docs'

const readDirRecursive = async (dir) => {
const files = await fs.readdir(dir)

Expand All @@ -14,11 +12,12 @@ const readDirRecursive = async (dir) => {
if (stats.isDirectory() && !excludedDirectories.includes(file)) {
await readDirRecursive(filePath)
} else if (file.startsWith('page.')) {
const loc = `${URL}${filePath
const loc = filePath
.replace('src/app', '')
.replace('.tsx', '')
.replace('.mdx', '')
.replace('page', '')}`.replace(/\/$/, '')
.replace('page', '')
.replace(/\/$/, '')

pages.push(loc)
}
Expand Down
8 changes: 5 additions & 3 deletions scripts/cypress-fixtures.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ import { XMLParser } from 'fast-xml-parser'
const parser = new XMLParser()

import { allDocs } from '../.contentlayer/generated/index.mjs'
import pages from '../src/assets/sitemap.json' with { type: 'json' }
import basePages from '../src/assets/sitemap.json' with { type: 'json' }

const FIXTURE_PATH = 'cypress/fixtures/pages.json'

const PROD_PAGES_PATH = 'cypress/fixtures/prod_pages.json'

async function run() {
try {
const basePages = pages.map((p) => p.replace('https://nitric.io', ''))
const staticPages = basePages.map((page) => `/docs${page}`)

const docPages = allDocs.map((doc) => {
return doc.slug === '/' ? '/docs' : `/docs/${doc.slug}`
})

const paths = [...basePages, ...docPages].sort((a, b) => a.localeCompare(b))
const paths = [...staticPages, ...docPages].sort((a, b) =>
a.localeCompare(b),
)

console.log(`${paths.length} paths found. Generating fixture`)

Expand Down
5 changes: 3 additions & 2 deletions src/app/(sitemaps)/sitemap-0.xml/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { allDocs } from '@/content'
import staticPaths from '@/assets/sitemap.json'
import { BASE_URL } from '@/lib/constants'

const URL = 'https://nitric.io/docs'
const URL = `${BASE_URL}/docs`

interface SitemapItem {
loc: string
Expand All @@ -15,7 +16,7 @@ const lastmod = new Date().toISOString()
// Function to construct the XML structure of the sitemap index.
export async function GET() {
const pages = staticPaths.map((page) => ({
loc: page,
loc: `${URL}${page}`,
lastmod,
changefreq: 'daily',
priority: 0.7,
Expand Down
6 changes: 3 additions & 3 deletions src/app/(sitemaps)/sitemap.xml/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BASE_URL } from '@/lib/constants'

// Function to construct the XML structure of the sitemap index.
export async function GET() {
const sitemapIndexXML = buildSitemapIndex([
'https://nitric.io/docs/sitemap-0.xml',
])
const sitemapIndexXML = buildSitemapIndex([`${BASE_URL}/docs/sitemap-0.xml`])

// Return the sitemap index XML with the appropriate content type.
return new Response(sitemapIndexXML, {
Expand Down
Loading