refactor: move docs to the main repo; make cot-site a lib#77
Conversation
65bd9ee to
d8c3904
Compare
563c754 to
3edd3d6
Compare
This changes the character of the repository. Now it's no longer an actual website, but rather an engine to build the website. It requires providing the documentation for the "master" version of the guide, while the older versions are stored directly on this repository. Eventually, newer versions will use git submodules to pull the docs from the `cot` repository as well. This is a part of the initiative to bring better documentation to Cot: cot-rs/cot#471
3edd3d6 to
17d37ae
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors cot-site into more of a reusable “website engine” by moving guide/markdown content out of src/md-pages into a docs/ tree, adding a proc-macro path scheme that can load markdown from an external repo layout, and precomputing/caching parsed pages + the Pagefind search index during app initialization.
Changes:
- Move versioned guide markdown from
src/md-pages/**intodocs/**and adjust the markdown proc-macro to read from those paths (plus a newexternal_md_pagemacro). - Refactor guide parsing so pages are pre-parsed once and passed around via
Arc<ParsedPages>. - Change search index initialization to happen in
CotSiteApp::init()(global OnceCell), removing lazy generation from theFromRequestHeadextractor.
Reviewed changes
Copilot reviewed 29 out of 81 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/search.rs |
Search index generation now consumes pre-parsed pages and expects global initialization via SEARCH_INDEX. |
src/lib.rs |
Converts app into a reusable engine (CotSiteApp with pre-parsed pages), initializes Pagefind index in init(), and exposes error handler as a function. |
src/guides.rs |
Refactors guide parsing to build a per-version map once (ParsedPages) and removes per-request parsing. |
README.md |
Renames project to “Cot Website Engine” and clarifies guide content lives in the cot repo. |
Cargo.toml |
Adds licensing, new deps (async-trait/rustversion), and switches cot to a git rev. |
.gitignore |
Adds Cargo.lock to ignored entries. |
Dockerfile |
Removed. |
compose.yml |
Removed. |
compose.dev.yml |
Removed. |
bacon.toml |
Removed. |
.github/workflows/docker.yml |
Removed Docker image CI workflow. |
.dockerignore |
Removed. |
cot-site-macros/src/md_pages.rs |
Changes markdown file resolution to arbitrary paths; adds input type for external markdown. |
cot-site-macros/src/lib.rs |
Adds external_md_page proc macro and updates md_page to read from docs/{prefix}. |
cot-site-macros/Cargo.toml |
Adds license; adds rustversion build-dependency. |
cot-site-macros/build.rs |
Adds nightly detection + cfg emission for tracked paths (but has a directive formatting bug). |
cot-site-common/Cargo.toml |
Adds license metadata. |
src/md-pages/v0.5/upgrade-guide.md |
Removed (moved to docs/v0.5/upgrade-guide.md). |
src/md-pages/v0.5/testing.md |
Removed (moved to docs/v0.5/testing.md). |
src/md-pages/v0.5/static-files.md |
Removed (moved to docs/v0.5/static-files.md). |
src/md-pages/v0.5/sending-emails.md |
Removed (moved to docs/v0.5/sending-emails.md). |
src/md-pages/v0.5/openapi.md |
Removed (moved to docs/v0.5/openapi.md). |
src/md-pages/v0.5/framework-comparison.md |
Removed (moved to docs/v0.5/framework-comparison.md). |
src/md-pages/v0.5/forms.md |
Removed (moved to docs/v0.5/forms.md). |
src/md-pages/v0.5/error-pages.md |
Removed (moved to docs/v0.5/error-pages.md). |
src/md-pages/v0.5/db-models.md |
Removed (moved to docs/v0.5/db-models.md). |
src/md-pages/v0.5/caching.md |
Removed (moved to docs/v0.5/caching.md). |
src/md-pages/v0.5/admin-panel.md |
Removed (moved to docs/v0.5/admin-panel.md). |
src/md-pages/master/introduction.md |
Removed (master docs now expected externally / via new macro). |
docs/v0.5/upgrade-guide.md |
Added versioned guide content under docs/. |
docs/v0.5/testing.md |
Added versioned guide content under docs/. |
docs/v0.5/static-files.md |
Added versioned guide content under docs/. |
docs/v0.5/sending-emails.md |
Added versioned guide content under docs/. |
docs/v0.5/framework-comparison.md |
Added versioned guide content under docs/. |
docs/v0.5/forms.md |
Added versioned guide content under docs/. |
docs/v0.5/error-pages.md |
Added versioned guide content under docs/. |
docs/v0.5/caching.md |
Added versioned guide content under docs/. |
docs/v0.5/admin-panel.md |
Added versioned guide content under docs/. |
docs/v0.4/upgrade-guide.md |
Added versioned guide content under docs/. |
docs/v0.4/testing.md |
Added versioned guide content under docs/. |
docs/v0.4/static-files.md |
Added versioned guide content under docs/. |
docs/v0.4/forms.md |
Added versioned guide content under docs/. |
docs/v0.4/error-pages.md |
Added versioned guide content under docs/. |
docs/v0.4/db-models.md |
Added versioned guide content under docs/. |
docs/v0.4/admin-panel.md |
Added versioned guide content under docs/. |
docs/v0.3/testing.md |
Added versioned guide content under docs/. |
docs/v0.3/static-files.md |
Added versioned guide content under docs/. |
docs/v0.3/forms.md |
Added versioned guide content under docs/. |
docs/v0.3/error-pages.md |
Added versioned guide content under docs/. |
docs/v0.3/db-models.md |
Added versioned guide content under docs/. |
docs/v0.3/admin-panel.md |
Added versioned guide content under docs/. |
docs/v0.2/testing.md |
Added versioned guide content under docs/. |
docs/v0.2/static-files.md |
Added versioned guide content under docs/. |
docs/v0.2/forms.md |
Added versioned guide content under docs/. |
docs/v0.2/error-pages.md |
Added versioned guide content under docs/. |
docs/v0.2/db-models.md |
Added versioned guide content under docs/. |
docs/v0.2/admin-panel.md |
Added versioned guide content under docs/. |
docs/v0.1/testing.md |
Added versioned guide content under docs/. |
docs/v0.1/static-files.md |
Added versioned guide content under docs/. |
docs/v0.1/forms.md |
Added versioned guide content under docs/. |
docs/v0.1/error-pages.md |
Added versioned guide content under docs/. |
docs/v0.1/db-models.md |
Added versioned guide content under docs/. |
docs/v0.1/admin-panel.md |
Added versioned guide content under docs/. |
docs/licenses.md |
Adds consolidated licenses page in docs/. |
docs/faq.md |
Adds FAQ page in docs/. |
Comments suppressed due to low confidence (1)
src/lib.rs:323
context.router()is assigned torouterbut never used. If this call is only meant for side effects, rename the binding to_router(or add a clarifying comment); otherwise remove it to avoid dead code and confusion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fn main() { | ||
| build_syntax_highlighting_defs(); | ||
|
|
||
| println!("cargo::rustc-check-cfg=cfg(cot_use_nightly)"); |
There was a problem hiding this comment.
I think that's a valid suggestion
There was a problem hiding this comment.
It's not, it's a hallucination: https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-check-cfg
It seems like both work; if anything, I can change everything to double colons so that it's consistent with the official docs.
EDIT: "both work" since 1.77: "MSRV: 1.77 is required for cargo::KEY=VALUE syntax. To support older versions, use the cargo:KEY=VALUE syntax."
seqre
left a comment
There was a problem hiding this comment.
Is this only going to be used as a git repository or did you forget to add release-plz here?
| fn main() { | ||
| build_syntax_highlighting_defs(); | ||
|
|
||
| println!("cargo::rustc-check-cfg=cfg(cot_use_nightly)"); |
There was a problem hiding this comment.
I think that's a valid suggestion
I don't think there's a reason to publish this on crates.io. It's only an internal thing anyway, and it's easier to work on changes here when it's not being published. |
| } | ||
|
|
||
| impl CotSiteApp { | ||
| pub fn new(master_pages: Vec<(&'static str, Vec<MdPage>)>) -> Self { |
There was a problem hiding this comment.
We should add some documentation here indicating that the method takes in the name of a section and the list of pages in that section
No description provided.