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

chore: docs deprecated files cleanup and reorg #401

Merged
merged 3 commits into from
Feb 18, 2025
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
1 change: 1 addition & 0 deletions index-pages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const ignore = [
// [nextjs_dynamic_pages]
// 404 and 500 error pages
/^([_.[]|404|500).*$/,
/^__components\/.*/
]

const pageFilter = (file) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { RecipesDocument } from '@src/generated/graphql'
import { readMdFileCached } from '@src/markdoc/mdParser'
import { providerToProviderName } from '@src/utils/text'

import type { MarkdocHeading, MyPageProps } from '../_app'
import type { MarkdocHeading, MyPageProps } from '../../pages/_app'
import type {
RecipeFragment,
RecipesQuery,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 24 additions & 9 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,20 @@ export const getStaticPaths: GetStaticPaths = async () => {
const relativePath = path.relative(pagesDirectory, file)
const parsedPath = path.parse(relativePath)

const dirSegments = parsedPath.dir ? parsedPath.dir.split(path.sep) : []
// Remove numeric prefixes from directory names and file name
const cleanDirName = parsedPath.dir
.split(path.sep)
.map((segment) => segment.replace(/^\d+-/, ''))
.join(path.sep)

const cleanFileName = parsedPath.name.replace(/^\d+-/, '')

const dirSegments = cleanDirName ? cleanDirName.split(path.sep) : []

let slug: string[]

if (parsedPath.name === 'index') slug = dirSegments
else slug = [...dirSegments, parsedPath.name]
if (cleanFileName === 'index') slug = dirSegments
else slug = [...dirSegments, cleanFileName]

return {
params: {
Expand All @@ -76,12 +84,19 @@ export const getStaticProps: GetStaticProps<

const slugPath = params.slug.join('/')

// looks for folder/name/index.md first, then folder/name.md
const filePath =
[
path.join('pages', slugPath, 'index.md'),
path.join('pages', `${slugPath}.md`),
].find(fs.existsSync) || null
// Try both with and without numeric prefixes
const possiblePaths = [
path.join('pages', slugPath, 'index.md'),
path.join('pages', `${slugPath}.md`),
// Add these new patterns
...fs
.readdirSync('pages')
.filter((f) => f.match(/^\d+-.*\.md$/))
.filter((f) => f.replace(/^\d+-/, '').replace(/\.md$/, '') === slugPath)
.map((f) => path.join('pages', f)),
]

const filePath = possiblePaths.find(fs.existsSync) || null

if (!filePath) {
return { notFound: true }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions pages/operations/advanced-operations.md

This file was deleted.

3 changes: 0 additions & 3 deletions pages/reference/faq.md

This file was deleted.

3 changes: 0 additions & 3 deletions pages/reference/glossary.md

This file was deleted.

15 changes: 0 additions & 15 deletions pages/reference/index.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions pages/test/global-variables.md

This file was deleted.

20 changes: 7 additions & 13 deletions src/NavData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,8 @@ const rootNavData: NavMenu = deepFreeze([
title: 'Notifications',
},
{
href: '/deployments/operations',
title: 'Advanced Operations',
sections: [
{
title: 'Managing Deprecations and K8s upgrades',
href: '/deployments/deprecations',
},
],
title: 'Deprecations and upgrades',
href: '/deployments/deprecations',
},
],
},
Expand Down Expand Up @@ -263,15 +257,15 @@ const rootNavData: NavMenu = deepFreeze([
title: 'Service Catalog',
sections: [
{
href: '/catalog/overview',
href: '/service-catalog/overview',
title: 'Overview',
},
{
href: '/catalog/creation',
href: '/service-catalog/creation',
title: 'Creating Your Own Catalog',
},
{
href: '/catalog/contributing',
href: '/service-catalog/contributing',
title: 'Contributing to the Mainline Plural Catalog',
},
],
Expand All @@ -280,11 +274,11 @@ const rootNavData: NavMenu = deepFreeze([
title: 'FAQ',
sections: [
{
href: '/operations/security',
href: '/faq/security',
title: 'What does Plural have access to?',
},
{
href: '/operations/auth-access-control/openid-connect',
href: '/faq/openid-connect',
title: 'What is Plural OIDC?',
},
{
Expand Down
114 changes: 9 additions & 105 deletions src/generated/pages.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,4 @@
[
{
"path": "/adding-new-application/background-app-install"
},
{
"path": "/adding-new-application/getting-started-with-runbooks"
},
{
"path": "/adding-new-application/getting-started-with-runbooks/runbook-xml"
},
{
"path": "/adding-new-application/getting-started-with-runbooks/runbook-yaml"
},
{
"path": "/adding-new-application/guide"
},
{
"path": "/adding-new-application"
},
{
"path": "/adding-new-application/module-library"
},
{
"path": "/adding-new-application/plural-artifact-structure"
},
{
"path": "/adding-new-application/plural-custom-resources"
},
{
"path": "/adding-new-application/publishing"
},
{
"path": "/adding-new-application/templating"
},
{
"path": "/ai/architecture"
},
Expand All @@ -44,66 +11,6 @@
{
"path": "/ai/setup"
},
{
"path": "/applications"
},
{
"path": "/archive/architecture"
},
{
"path": "/archive/basics/AdminConsole"
},
{
"path": "/archive/basics/Architecture"
},
{
"path": "/archive/basics/GettingStarted"
},
{
"path": "/archive/basics/SecretManagement"
},
{
"path": "/archive/basics/WorkspaceLayout"
},
{
"path": "/archive/cloud-shell"
},
{
"path": "/archive/introduction"
},
{
"path": "/archive/secret-management"
},
{
"path": "/archive/sharing-existing-repos"
},
{
"path": "/archive/workspace-structure"
},
{
"path": "/catalog/contributing"
},
{
"path": "/catalog/creation"
},
{
"path": "/catalog/overview"
},
{
"path": "/debugging/application-issues"
},
{
"path": "/debugging/health-checks"
},
{
"path": "/debugging"
},
{
"path": "/debugging/logs"
},
{
"path": "/debugging/proxies"
},
{
"path": "/deployments/addons"
},
Expand Down Expand Up @@ -266,21 +173,12 @@
{
"path": "/faq/certifications"
},
{
"path": "/faq/local-development"
},
{
"path": "/faq/plural-paid-tiers"
},
{
"path": "/getting-started/admin-console"
},
{
"path": "/getting-started/cloud-shell-quickstart"
},
{
"path": "/getting-started/concepts"
},
{
"path": "/getting-started/deployments"
},
Expand Down Expand Up @@ -464,6 +362,15 @@
{
"path": "/reference/troubleshooting"
},
{
"path": "/service-catalog/contributing"
},
{
"path": "/service-catalog/creation"
},
{
"path": "/service-catalog/overview"
},
{
"path": "/stacks/auto-cancellation"
},
Expand All @@ -479,9 +386,6 @@
{
"path": "/stacks/manual-runs"
},
{
"path": "/stacks/overview"
},
{
"path": "/stacks/pr-workflow"
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@pages/*": ["pages/*"]
}
},
"include": ["next-env.d.ts", "pages/**/*", "src/**/*"],
"include": ["next-env.d.ts", "pages/**/*", "src/**/*", "pages-archive/applications"],
"exclude": ["node_modules"]
}
Loading