Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
with:
expected_sha: ${{ github.sha }}
target_env: live
pantheon_site_machine_name: documentation-in-nextjs
pantheon_site_machine_name: ${{ vars.PANTHEON_SITE_MACHINE_NAME }}
14 changes: 7 additions & 7 deletions .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
with:
expected_sha: ${{ github.event.pull_request.head.sha }}
target_env: pr-${{ github.event.pull_request.number }}
pantheon_site_machine_name: documentation-in-nextjs
pantheon_site_machine_name: ${{ vars.PANTHEON_SITE_MACHINE_NAME }}

- name: warm containers
id: warm_containers
shell: bash
env:
REFERENCE_BASE_URL: "https://dev-documentation-in-nextjs.pantheonsite.io"
DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-documentation-in-nextjs.pantheonsite.io"
REFERENCE_BASE_URL: "https://dev-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io"
DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io"
run: |
#!/bin/bash
set +e
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Check all status codes
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
SITE_NAME: "documentation-in-nextjs"
SITE_NAME: "${{ vars.PANTHEON_SITE_MACHINE_NAME }}"
run: |
cd tests/404checking
export URL="https://pr-${PR_NUMBER}-${SITE_NAME}.pantheonsite.io"
Expand Down Expand Up @@ -86,8 +86,8 @@ jobs:
id: backstop_tests
shell: bash
env:
REFERENCE_BASE_URL: "https://dev-documentation-in-nextjs.pantheonsite.io"
DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-documentation-in-nextjs.pantheonsite.io"
REFERENCE_BASE_URL: "https://dev-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io"
DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io"
run: |
#!/bin/bash
set +e
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
id: playwright_tests
shell: bash
env:
PLAYWRIGHT_DOMAIN: "pr-${{ github.event.pull_request.number }}-documentation-in-nextjs.pantheonsite.io"
PLAYWRIGHT_DOMAIN: "pr-${{ github.event.pull_request.number }}-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io"
run: |
#!/bin/bash
set +e
Expand Down
51 changes: 2 additions & 49 deletions src/components/omniSideBarNav.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,21 @@
"use server";
import {
findSubMenuItemsToUse,
getOmniSidebarActiveSection,
} from "./omni-components/helpers";
import { getOmniSidebarActiveSection } from "./omni-components/helpers";

import { SideNavCompact } from "./ui/pds-re-export";
import { Navbar } from "./common/navbar";
import { MOBILE_MENU_BREAKPOINT } from "@/constants";
import { getOmniItems } from "./omni-components";
import { turnItemsIntoLinks } from "./omni-components/client-helper";

export const OmniSidebarNav = async ({
activePage,
fallbackItems = null,
fallbackTitle = "",
submenuPathToUse = "",
slot = "",
}: {
activePage: string;
fallbackItems?: any[] | null;
fallbackTitle: string;
submenuPathToUse: string;
slot?: string;
}) => {
const OmniItems = await getOmniItems();

/* Reporting debug code
const flattenedOmniItems = flattenOmniItems(OmniItems);
const results = CalculateFilteredPathsInMenu(
filteredWrittenPaths,
flattenedOmniItems,
);
console.log(results);
*/

const menuItems = getOmniSidebarActiveSection(activePage, OmniItems);

// If the caller is asking for a specific submenu, use that directly.
if (submenuPathToUse.length > 0) {
const submenuItems = findSubMenuItemsToUse(submenuPathToUse, OmniItems);
if (!submenuItems) {
return null;
}
const submenuLinks = turnItemsIntoLinks(submenuItems, activePage);
return (
<SideNavCompact
mobileMenuMaxWidth={MOBILE_MENU_BREAKPOINT}
className="sidenav-compact"
ariaLabel={submenuLinks.linkContent}
headingText={submenuLinks.linkContent}
menuItems={submenuLinks.links}
/>
);
} else if (menuItems) {
if (menuItems) {
const OmniLinks = turnItemsIntoLinks(menuItems, activePage);
return (
<SideNavCompact
Expand All @@ -63,16 +26,6 @@ export const OmniSidebarNav = async ({
menuItems={OmniLinks.links}
/>
);
} else if (fallbackItems && fallbackItems.length > 0) {
return (
<>
<Navbar
title={fallbackTitle}
activePage={activePage}
items={fallbackItems}
/>
</>
);
} else {
return <div></div>;
}
Expand Down
15 changes: 0 additions & 15 deletions src/lib/page-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,6 @@ export type PageData = PageDataWithoutComponent & {
Component: React.ReactNode;
};

/* This helper function helps determine which template should be applied to a piece of content */
export const calculateTemplate = (
node: ProcessedFile,
defaultTemplate: "doc" | "terminuspage" | "certificationpage" | "video"
) => {
if (
node.frontmatter &&
node.frontmatter.layout &&
node.frontmatter.layout !== null
) {
return node.frontmatter.layout;
}
return defaultTemplate;
};

export const normalizeSlug = (slug: string): string => {
let normalizedSlug = slug;
if (normalizedSlug.startsWith("/")) {
Expand Down
57 changes: 10 additions & 47 deletions src/lib/resolve-component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageDataWithoutComponent, calculateTemplate } from "./page-utils";
import { PageDataWithoutComponent } from "./page-utils";

export const serveLocal = (search?: { local?: "true" | "false" }) => {
let useLocal = false;
Expand Down Expand Up @@ -38,59 +38,22 @@ export const resolveComponent = async (
): Promise<{ Component: React.ReactNode; template: string }> => {
switch (pageData.type) {
case "doc": {
const template = calculateTemplate(pageData.data.doc, "doc");

if (template === "doc") {
const Doc = await import(`@/templates/doc`);
return {
Component: <Doc.DocTemplate doc={pageData.data.doc} />,
template: "doc",
};
} else if (template === "terminuspage") {
const Terminus = await import(`@/templates/terminus`);
return {
Component: <Terminus.TerminusTemplate terminus={pageData.data.doc} />,
template: "terminuspage",
};
} else if (template === "certificationpage") {
const Certification = await import(`@/templates/certification`);
return {
Component: (
<Certification.CertificationTemplate
certification={pageData.data.doc}
/>
),
template: "certification",
};
} else if (template === "video") {
const Video = await import(`@/templates/guide`);
return {
Component: (
<Video.GuideTemplate
guide={pageData.data.doc}
prev={null}
next={null}
/>
),
template: "video",
};
} else {
const Doc = await import(`@/templates/doc`);
return {
Component: <Doc.DocTemplate doc={pageData.data.doc} />,
template: "doc",
};
}
const Doc = await import(`@/templates/doc`);
return {
Component: <Doc.DocTemplate doc={pageData.data.doc} />,
template: "doc",
};
}

case "guide": {
const Guide = await import(`@/templates/guide`);
const Doc = await import(`@/templates/doc`);
return {
Component: (
<Guide.GuideTemplate
guide={pageData.data.guide}
<Doc.DocTemplate
doc={pageData.data.guide}
prev={pageData.data.prev}
next={pageData.data.next}
tocDefault={false}
/>
),
template: "guide",
Expand Down
2 changes: 1 addition & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export function middleware(request: NextRequest) {
// This section handles the HTTP to HTTPS redirects for Pantheon sites.
// See https://github.com/pantheon-systems/documentation/issues/9791
// for more context.
const siteMachineName = "documentation-in-nextjs";
const siteMachineName = process.env.PANTHEON_SITE_MACHINE_NAME || "documentation-in-nextjs";
const incomingProtocol = request.headers.get('x-proto') || '';
const policyDocSurrogateKey = request.headers.get('policy-doc-surrogate-key') || '';
if (incomingProtocol === 'http://' && policyDocSurrogateKey) {
Expand Down
2 changes: 0 additions & 2 deletions src/source/content/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ description: Understand frontend and backend caching on our platform.
contributors: [dwayne]
permalink: docs/cache
tags: [cache]
layout: video
searchboost: 50
type: video
contenttype: [doc]
innav: [true]
categories: [cache]
Expand Down
3 changes: 0 additions & 3 deletions src/source/content/certification/about.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: "Benefits of Becoming WebOps Certified"
subtitle: "Learn about the Pantheon WebOps Certification program"
showtoc: true
contributors: []
layout: certificationpage
permalink: docs/certification/about
---

Expand Down
3 changes: 0 additions & 3 deletions src/source/content/certification/exam.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: "WebOps Certification: Exam Overview"
subtitle: "Pantheon WebOps Certification Exam Overview"
contributors: []
showtoc: true
layout: certificationpage
permalink: docs/certification/exam
---
## Exam Instructions
Expand Down
11 changes: 0 additions & 11 deletions src/source/content/certification/study-guide-cms/00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
title: WebOps Certification
subtitle: Study Guide Introduction
description: Learn about the three failure modes of website operations.
certificationpage: true
type: certificationpage
layout: certificationpage
showtoc: true
tags: []
permalink: docs/certification/study-guide
contenttype: [guide]
innav: [false]
categories: []
cms: [drupal, wordpress]
audience: []
product: []
integration: [--]
nexturl: /certification/study-guide/webops
---

Expand Down
11 changes: 0 additions & 11 deletions src/source/content/certification/study-guide-cms/01-webops.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
title: WebOps Certification
subtitle: "Chapter 1: WebOps"
description: Learn about the principles and benefits of WebOps.
certificationpage: true
showtoc: true
type: certificationpage
layout: certificationpage
tags: []
permalink: docs/certification/study-guide/webops
contenttype: [guide]
innav: [false]
categories: []
cms: [drupal, wordpress]
audience: []
product: []
integration: [--]
previousurl: /certification/study-guide
nexturl: /certification/study-guide/platform
---
Expand Down
11 changes: 0 additions & 11 deletions src/source/content/certification/study-guide-cms/02-platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
title: WebOps Certification
subtitle: "Chapter 2: Pantheon Platform"
description: Understand the layers of Pantheon's platform and how it can be used to solve problems using WebOps best practicies.
certificationpage: true
showtoc: true
type: certificationpage
layout: certificationpage
tags: []
permalink: docs/certification/study-guide/platform
contenttype: [guide]
innav: [false]
categories: []
cms: [drupal, wordpress]
audience: []
product: []
integration: [--]
previousurl: /certification/study-guide/webops
nexturl: /certification/study-guide/create
---
Expand Down
11 changes: 0 additions & 11 deletions src/source/content/certification/study-guide-cms/03-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
title: WebOps Certification
subtitle: "Chapter 3: Site Creation"
description: Learn how to create a site on Pantheon.
certificationpage: true
showtoc: true
type: certificationpage
layout: certificationpage
tags: []
permalink: docs/certification/study-guide/create
contenttype: [guide]
innav: [false]
categories: []
cms: [drupal, wordpress]
audience: []
product: []
integration: [--]
previousurl: /certification/study-guide/platform
nexturl: /certification/study-guide/cdn
---
Expand Down
11 changes: 0 additions & 11 deletions src/source/content/certification/study-guide-cms/04-cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
title: WebOps Certification
subtitle: "Chapter 4: Content Delivery Network"
description: Pantheon's edge layer increases the speed and scalability of all sites on the platform. The Advanced Global CDN can be customized for tailored usage.
certificationpage: true
type: certificationpage
layout: certificationpage
showtoc: true
tags: []
permalink: docs/certification/study-guide/cdn
contenttype: [guide]
innav: [false]
categories: []
cms: [drupal, wordpress]
audience: []
product: []
integration: [--]
previousurl: /certification/study-guide/create
nexturl: /certification/study-guide/cms
---
Expand Down
11 changes: 0 additions & 11 deletions src/source/content/certification/study-guide-cms/05-cms.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
title: WebOps Certification
subtitle: "Chapter 5: CMS Infrastructure"
description: Pantheon's containerized infrastructure makes CMS applications faster, more scalable, and more secure.
certificationpage: true
type: certificationpage
layout: certificationpage
showtoc: true
tags: []
permalink: docs/certification/study-guide/cms
contenttype: [guide]
innav: [false]
categories: []
cms: [drupal, wordpress]
audience: []
product: []
integration: [--]
previousurl: /certification/study-guide/cdn
nexturl: /certification/study-guide/deploy
---
Expand Down
Loading
Loading