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

Configurable navigation #118

Merged
merged 4 commits into from
Nov 8, 2023
Merged

Configurable navigation #118

merged 4 commits into from
Nov 8, 2023

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Nov 8, 2023

Loads a config.ts (or config.js) file from docs/.observablehq. Fixes #44.

For now, this is still just a flat list of pages, but it allows us to control the order and edit the titles that appear in the side bar. I can file a separate issue for hierarchical and collapsible sections in the sidebar.

I’ve also included in this PR a restructuring and more extensive scaffolding of the documentation #74. Because this adds many more pages, we want configurable navigation to keep the sidebar organized. I can break the documentation out into a downstream PR if needed, but please see src/config.ts and src/navigation.ts for the functional changes.

@mbostock mbostock force-pushed the mbostock/config branch 3 times, most recently from af5ffb2 to 9a54d0a Compare November 8, 2023 03:30
pages?: RenderOptions["pages"];
}

export async function readConfig(root: string): Promise<Config | undefined> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is intended to be a general config for the CLI, or it is just for the TOC? Would we want to be database config or other non-content options in here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s a config file for this project in the same fashion as VitePress, e.g.,

https://github.com/observablehq/plot/blob/main/docs/.vitepress/config.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Platform work for observable deploy will need to store some per-project configuration values, like which project we should deploy into. Do you think that information should be in this file, or elsewhere?

If we want to put that kind of configuration in this file, it would be nice if we could programmatically modify the settings file, which would be difficult to do for JS/TS file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a good question. Maybe anything auto-generated would need to live in a separate file. Eventually I can see us wanting to have plugins and dynamic behavior in the config file, so it’s nice to keep the config in code.

@mbostock mbostock merged commit 67b65f0 into main Nov 8, 2023
1 check passed
@mbostock mbostock deleted the mbostock/config branch November 8, 2023 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable navigation in the sidebar
3 participants