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

Fix "Edit this page" links for astro pages #1754

Merged
merged 3 commits into from
Feb 9, 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
1 change: 1 addition & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const baseFrontmatter = z
metadata,
excerpt: z.string().optional(),
datafeedtype: z.string().optional(),
fileExtension: z.string().optional(),
})
.strict()

Expand Down
9 changes: 8 additions & 1 deletion src/layouts/DocsLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ const whatsNext = frontmatter.whatsnext

const currentPage = new URL(Astro.request.url).pathname

const currentFile = `src/content${currentPage.replace(/\/$/, "")}${frontmatter.isIndex ? "/index" : ""}.mdx`
const fileExtension = frontmatter.fileExtension || "mdx"

const baseDirectory = fileExtension === "astro" ? "src/pages" : "src/content"

const currentFile = `${baseDirectory}${currentPage.replace(/\/$/, "")}${
frontmatter.isIndex ? "/index" : ""
}.${fileExtension}`

const githubEditUrl = CONFIG.GITHUB_EDIT_URL + currentFile
const formattedContentTitle = `${frontmatter.title} | ${CONFIG.SITE.title}`

Expand Down
2 changes: 1 addition & 1 deletion src/pages/chainlink-nodes.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import button from "@chainlink/design-system/button.module.css"
import styles from "@features/landing/styles/EthereumLandingPage.module.css"
---

<DocsLayout frontmatter={{ section: "nodeOperator", title: "Chainlink Nodes" }}>
<DocsLayout frontmatter={{ section: "nodeOperator", title: "Chainlink Nodes", fileExtension: "astro" }}>
<p>
Operating a Chainlink node allows you to be part of the Chainlink Network, helping developers build hybrid smart
contracts, giving them access to real-world data and services. Learn more about Chainlink nodes with our
Expand Down
Loading