Skip to content

Commit 93ea74e

Browse files
authored
ENG-1406 - Fix shared docs routing and rename Discourse Graph page (#757)
* Refactor static parameter generation for documentation pages to use unique document mappings and improve directory handling in DocsPage component. * Update links to "What is a discourse graph?" in navigation and documentation pages for consistency; remove outdated shared page.
1 parent c4d6fa3 commit 93ea74e

9 files changed

Lines changed: 51 additions & 41 deletions

File tree

apps/website/app/(docs)/docs/obsidian/[slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
1616
export default Page;
1717

1818
export const generateStaticParams = () =>
19-
generateDocsStaticParams(docMap.default);
19+
generateDocsStaticParams([...new Set(Object.values(docMap))]);
2020

2121
export const generateMetadata = async ({
2222
params,

apps/website/app/(docs)/docs/obsidian/navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const navigation: NavigationList = [
1515
links: [
1616
{
1717
title: "What is a discourse graph?",
18-
href: `${ROOT}/what-is-discourse-graph`,
18+
href: `${ROOT}/what-is-a-discourse-graph`,
1919
},
2020
{
2121
title: "Grammar",

apps/website/app/(docs)/docs/obsidian/pages/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: ""
55
published: true
66
---
77

8-
The Discourse Graph plugin enables [Obsidian](https://obsidian.md/) users to seamlessly add additional semantic structure to their notes, including specified page types and link types that [model scientific discourse](/docs/roam/what-is-discourse-graph), to enable more complex and structured knowledge synthesis work, such as a complex interdisciplinary literature review, and enhanced collaboration with others on this work.
8+
The Discourse Graph plugin enables [Obsidian](https://obsidian.md/) users to seamlessly add additional semantic structure to their notes, including specified page types and link types that [model scientific discourse](/docs/obsidian/what-is-a-discourse-graph), to enable more complex and structured knowledge synthesis work, such as a complex interdisciplinary literature review, and enhanced collaboration with others on this work.
99

1010
For more information about Discourse Graphs, check out our website at [https://discoursegraphs.com](https://discoursegraphs.com)
1111

@@ -19,7 +19,7 @@ For more information about Discourse Graphs, check out our website at [https://d
1919

2020
## What's Next?
2121

22-
- Learn about [what makes a discourse graph](./what-is-discourse-graph)
22+
- Learn about [what makes a discourse graph](./what-is-a-discourse-graph)
2323
- Explore [use cases](./literature-reviewing) for discourse graphs
2424
- Join our community to share your experience and get help
2525

@@ -37,6 +37,6 @@ Follow our handy guides to get started on the basics as quickly as possible:
3737

3838
Learn the fundamentals of the Discourse Graph plugin to get a deeper understanding of our main features:
3939

40-
- [What is a Discourse Graph?](./what-is-discourse-graph)
40+
- [What is a Discourse Graph?](./what-is-a-discourse-graph)
4141
- [The Discourse Graph plugin grammar](./grammar)
4242
- [The Base Grammar: questions, claims, and evidence](./base-grammar)

apps/website/app/(docs)/docs/roam/[slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Page = async ({ params }: Params) => {
2222
export default Page;
2323

2424
export const generateStaticParams = () =>
25-
generateDocsStaticParams(docMap.default);
25+
generateDocsStaticParams([...new Set(Object.values(docMap))]);
2626

2727
export const generateMetadata = async ({
2828
params,

apps/website/app/(docs)/docs/roam/navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const navigation: NavigationList = [
4848
links: [
4949
{
5050
title: "What is a discourse graph?",
51-
href: `${ROOT}/what-is-discourse-graph`,
51+
href: `${ROOT}/what-is-a-discourse-graph`,
5252
},
5353
{
5454
title: "Grammar",

apps/website/app/(docs)/docs/roam/pages/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: ""
55
published: true
66
---
77

8-
The Discourse Graph extension enables [Roam](https://roamresearch.com/) users to seamlessly add additional semantic structure to their notes, including specified page types and link types that [model scientific discourse](./what-is-discourse-graph), to enable more complex and structured [knowledge synthesis work](https://oasislab.pubpub.org/pub/54t0y9mk/release/3), such as a complex interdisciplinary literature review, and enhanced collaboration with others on this work.
8+
The Discourse Graph extension enables [Roam](https://roamresearch.com/) users to seamlessly add additional semantic structure to their notes, including specified page types and link types that [model scientific discourse](./what-is-a-discourse-graph), to enable more complex and structured [knowledge synthesis work](https://oasislab.pubpub.org/pub/54t0y9mk/release/3), such as a complex interdisciplinary literature review, and enhanced collaboration with others on this work.
99

1010
## Overview
1111

@@ -27,6 +27,6 @@ Follow our handy guides to get started on the basics as quickly as possible:
2727

2828
Learn the fundamentals of the Discourse Graph extension to get a deeper understanding of our main features:
2929

30-
- [What is a Discourse Graph?](./what-is-discourse-graph)
30+
- [What is a Discourse Graph?](./what-is-a-discourse-graph)
3131
- [The Discourse Graph extension grammar](./grammar)
3232
- [The base grammar: questions, claims, and evidence](./base-grammar)

apps/website/app/(docs)/docs/shared/docMap.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
12
// Shared paths
23
export const SHARED_DOCS = "app/(docs)/docs/sharedPages";
34

45
// Shared document mappings
56
export const sharedDocMap = {
6-
"what-is-discourse-graph": SHARED_DOCS,
7+
"what-is-a-discourse-graph": SHARED_DOCS,
78
"base-grammar": SHARED_DOCS,
89
"literature-reviewing": SHARED_DOCS,
910
"research-roadmapping": SHARED_DOCS,
@@ -15,4 +16,4 @@ export const sharedDocMap = {
1516
export type DocMapType = {
1617
default: string;
1718
[key: string]: string;
18-
};
19+
};

apps/website/app/(docs)/docs/sharedPages/what-is-discourse-graph.md renamed to apps/website/app/(docs)/docs/sharedPages/what-is-a-discourse-graph.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: "What is Discourse Graph"
2+
title: "What is a Discourse Graph"
33
date: "2025-01-01"
44
author: ""
55
published: true
66
---
77

8-
**Discourse graphs** are an information model for bodies of knowledge that emphasize discourse moves (such as questions, claims, and evidence), and relations (such as support or opposition), rather than papers or sources as the main units.
8+
**Discourse Graphs** are an information model for bodies of knowledge that emphasize discourse moves (such as questions, claims, and evidence), and relations (such as support or opposition), rather than papers or sources as the main units.
99

10-
To give an intuition for what it is, here is a figure of a visual representation of a simple discourse graph for a body of literature on bans and antisocial behavior in online forums. You may recognize similarities to things like argument maps.
10+
To give an intuition for what it is, here is a figure of a visual representation of a simple Discourse Graph for a body of literature on bans and antisocial behavior in online forums. You may recognize similarities to things like argument maps.
1111

1212
![](/docs/roam/argument-map.png)
1313

@@ -17,4 +17,4 @@ Consider how that information model foregrounds the conceptual building blocks a
1717

1818
This information model (theoretically!) has high potential for augmenting individual and collective "research-grade" synthesis (e.g., lit reviews for a dissertation or grant proposal).
1919

20-
Discourse graphs are not a new idea (you can read more about it in [this short (academic-focused) write-up](http://joelchan.me/assets/pdf/Discourse_Graphs_for_Augmented_Knowledge_Synthesis_What_and_Why.pdf) or this more [practically-oriented article](https://oasislab.pubpub.org/pub/54t0y9mk/release/3)), but the potential to use it for everyday research work is!
20+
Discourse Graphs are not a new idea (you can read more about it in [this short (academic-focused) write-up](http://joelchan.me/assets/pdf/Discourse_Graphs_for_Augmented_Knowledge_Synthesis_What_and_Why.pdf) or this more [practically-oriented article](https://oasislab.pubpub.org/pub/54t0y9mk/release/3)), but the potential to use it for everyday research work is!

apps/website/app/components/DocsPage.tsx

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,45 @@ export const DocsPage = async ({ params, directory }: DocsPageProps) => {
5151
}
5252
};
5353

54-
export const generateDocsStaticParams = async (directory: string) => {
55-
try {
56-
const directoryExists = await fs
57-
.stat(directory)
58-
.then((stats) => stats.isDirectory())
59-
.catch(() => false);
54+
const generateParamsForDirectory = async (directory: string) => {
55+
const directoryExists = await fs
56+
.stat(directory)
57+
.then((stats) => stats.isDirectory())
58+
.catch(() => false);
6059

61-
if (!directoryExists) {
62-
console.log("No docs directory found");
63-
return [];
64-
}
60+
if (!directoryExists) {
61+
console.log("No docs directory found");
62+
return [];
63+
}
6564

66-
const files = await fs.readdir(directory);
67-
const mdFiles = files.filter((filename) => filename.endsWith(".md"));
65+
const files = await fs.readdir(directory);
66+
const mdFiles = files.filter((filename) => filename.endsWith(".md"));
6867

69-
const publishedFiles = await Promise.all(
70-
mdFiles.map(async (filename) => {
71-
const { published } = await getFileMetadata({
72-
filename,
73-
directory,
74-
});
75-
return { filename, published };
76-
}),
77-
);
68+
const publishedFiles = await Promise.all(
69+
mdFiles.map(async (filename) => {
70+
const { published } = await getFileMetadata({
71+
filename,
72+
directory,
73+
});
74+
return { filename, published };
75+
}),
76+
);
7877

79-
return publishedFiles
80-
.filter(({ published }) => published)
81-
.map(({ filename }) => ({
82-
slug: filename.replace(/\.md$/, ""),
83-
}));
78+
return publishedFiles
79+
.filter(({ published }) => published)
80+
.map(({ filename }) => ({ slug: filename.replace(/\.md$/, "") }));
81+
};
82+
83+
export const generateDocsStaticParams = async (
84+
directories: string | string[],
85+
) => {
86+
try {
87+
const dirs =
88+
typeof directories === "string" ? [directories] : [...directories];
89+
const results = await Promise.all(
90+
dirs.map((dir) => generateParamsForDirectory(dir)),
91+
);
92+
return results.flat();
8493
} catch (error) {
8594
console.error("Error generating static params:", error);
8695
return [];

0 commit comments

Comments
 (0)