Skip to content

Commit

Permalink
add id for article (#2469)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-fusionauth committed Sep 5, 2023
1 parent 4434f32 commit a2fd4a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion astro/src/components/GitHubEdit.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export function getGithubEditUrl(Astro: Readonly<AstroGlobal>) {
const path = Astro.url.pathname;
const splitSlug = slug?.split("/");
const { id } = Astro.props; // Passed from page level
// Each file layout is unique
let appendFile = "";
if (path.includes("/articles/")) {
appendFile = splitSlug?.length
? splitSlug?.length > 1
? path.replace(`${slug}`, "") + `${slug}.md`
? path.replace(`${slug}`, "") + id
: path + `index.mdx`
: path;
} else if (path.includes("/dev-tools/")) {
Expand Down
2 changes: 1 addition & 1 deletion astro/src/layouts/Default.astro
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cta = frontmatter.cta ? frontmatter.cta : cta;
<Navigation items={sideMenu}/>

<!-- Contribute -->
<GitHubEdit />
<GitHubEdit {...Astro.props} />
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion astro/src/pages/articles/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export async function getStaticPaths() {
const { entry } = Astro.props;
const { Content, headings } = await entry.render();
---
<Layout frontmatter={entry.data} headings={headings}>
<Layout frontmatter={entry.data} headings={headings} id={entry.id}>
<Content/>
</Layout>

0 comments on commit a2fd4a8

Please sign in to comment.