From d4fafdd8f2b3dfddfe3a70f3a6b0ab51e922de47 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Mon, 30 Sep 2024 14:26:24 +0200 Subject: [PATCH] Strip out docs and modules, redirect to docs.seqera.io (#107) --- astro.config.mjs | 14 -- netlify.toml | 13 +- src/components/navbar/Navbar.astro | 17 +- src/components/navbar/NavbarDocsNav.svelte | 39 ----- src/components/navbar/NavbarDocsNavMenu.astro | 55 ------- .../navbar/NavbarDocsNavTitle.astro | 27 ---- src/config.yaml | 1 - src/content/config.ts | 21 --- src/content/docs | 1 - src/content/modules | 1 - src/docs/images | 1 - src/layouts/DocsLayout.astro | 146 ------------------ src/pages/docs/[...slug].astro | 51 ------ src/pages/index.astro | 23 ++- src/pages/modules/[module].astro | 51 ------ src/pages/modules/index.astro | 117 -------------- src/pages/run.astro | 3 +- 17 files changed, 33 insertions(+), 548 deletions(-) delete mode 100644 src/components/navbar/NavbarDocsNav.svelte delete mode 100644 src/components/navbar/NavbarDocsNavMenu.astro delete mode 100644 src/components/navbar/NavbarDocsNavTitle.astro delete mode 120000 src/config.yaml delete mode 120000 src/content/docs delete mode 120000 src/content/modules delete mode 120000 src/docs/images delete mode 100644 src/layouts/DocsLayout.astro delete mode 100644 src/pages/docs/[...slug].astro delete mode 100644 src/pages/modules/[module].astro delete mode 100644 src/pages/modules/index.astro diff --git a/astro.config.mjs b/astro.config.mjs index 41a043f2..705a88f9 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -79,20 +79,6 @@ export default defineConfig({ ), }, ], - // Rewrite the image paths to be absolute for rehypeInline plugin - [ - urls, - (url) => { - if (url.href.startsWith("../../images/")) { - return url.href.replace("../../images/", "../MultiQC/docs/images/"); - } else { - var match = url.href.match(/\.\.\/.+\.md/); - if (match && match.length > 0) { - return url.href.replace(/\.\.\/(.+)\.md/, "/docs/$1"); - } - } - }, - ], [ rehypePrettyCode, { diff --git a/netlify.toml b/netlify.toml index 74196b51..5d073e79 100644 --- a/netlify.toml +++ b/netlify.toml @@ -11,6 +11,18 @@ status = 301 force = true +[[redirects]] + from = "/docs/*" + to = "https://docs.seqera.io/multiqc/:splat" + status = 301 + force = true + +[[redirects]] + from = "/modules/*" + to = "https://docs.seqera.io/multiqc/modules/:splat" + status = 301 + force = true + [[headers]] for = "/_astro/*" [headers.values] @@ -28,7 +40,6 @@ status = 301 force = true - [[plugins]] package = "@algolia/netlify-plugin-crawler" [plugins.inputs] diff --git a/src/components/navbar/Navbar.astro b/src/components/navbar/Navbar.astro index 7bcece00..5c576ce5 100644 --- a/src/components/navbar/Navbar.astro +++ b/src/components/navbar/Navbar.astro @@ -1,9 +1,6 @@ --- import NavbarMenu from "@components/navbar/NavbarMenu.astro"; import NavbarMenuMobile from "@components/navbar/NavbarMenuMobile.svelte"; -import NavbarDocsNav from "@components/navbar/NavbarDocsNav.svelte"; -import NavbarDocsNavTitle from "@components/navbar/NavbarDocsNavTitle.astro"; -import NavbarDocsNavMenu from "@components/navbar/NavbarDocsNavMenu.astro"; import HeroBackgroundSrc from "@assets/images/background.png"; import { getImage } from "astro:assets"; @@ -25,9 +22,9 @@ export interface Props { } const navPages = [ - { slug: "/docs/", text: "Documentation", text_sm: "Docs" }, + { slug: "https://docs.seqera.io/multiqc", text: "Documentation", text_sm: "Docs" }, { slug: "/example-reports/", text: "Examples" }, - { slug: "/modules/", text: "Supported Tools", text_sm: "Tools" }, + { slug: "https://docs.seqera.io/multiqc/modules/", text: "Supported Tools", text_sm: "Tools" }, { text: "Resources", items: [ @@ -38,7 +35,7 @@ const navPages = [ { slug: "/citation/", text: "Citation" }, ], }, - { slug: "https://community.seqera.io/c/multiqc/6", text: "Forums" }, + { slug: "https://community.seqera.io/multiqc", text: "Forums" }, ]; const { title, headings = [], navbarItems = navPages } = Astro.props; @@ -51,12 +48,4 @@ const { title, headings = [], navbarItems = navPages } = Astro.props;
- { - Astro.url.pathname.includes("/docs/") && ( - - - - - ) - }
diff --git a/src/components/navbar/NavbarDocsNav.svelte b/src/components/navbar/NavbarDocsNav.svelte deleted file mode 100644 index 9a3c423b..00000000 --- a/src/components/navbar/NavbarDocsNav.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - -
- -
- -{#if visible} -
-
- -
-{/if} diff --git a/src/components/navbar/NavbarDocsNavMenu.astro b/src/components/navbar/NavbarDocsNavMenu.astro deleted file mode 100644 index dfc2510a..00000000 --- a/src/components/navbar/NavbarDocsNavMenu.astro +++ /dev/null @@ -1,55 +0,0 @@ ---- -// Fetch the config.yml that has section titles and order of pages -import docs_nav from "@src/config.yaml"; - -const sections: { - section: Record; - pages: [string, { file: string; frontmatter: { title: string } }]; -}[] = []; -const all_docs = await Astro.glob("../../../../MultiQC/docs/core/**/*.{md,mdx}"); -docs_nav["nav"].forEach((section) => { - let pages = []; - Object.values(section)[0].forEach((filename) => { - var url = "/docs/" + filename.replace(/\.(md|mdx)$/, "").replace(/index$/, ""); - var filtered = all_docs.filter(function (el) { - return el.file.endsWith("docs/core/" + filename); - }); - pages.push([url, filtered[0]]); - }); - sections.push({ section: section, pages: pages }); -}); ---- - -{ - sections && - sections.map((section) => ( -
-
{Object.keys(section.section)[0]}
- -
- )) -} diff --git a/src/components/navbar/NavbarDocsNavTitle.astro b/src/components/navbar/NavbarDocsNavTitle.astro deleted file mode 100644 index 3e1f82c7..00000000 --- a/src/components/navbar/NavbarDocsNavTitle.astro +++ /dev/null @@ -1,27 +0,0 @@ ---- -import { Icon } from "astro-icon/components"; - -// Fetch the config.yml that has section titles and order of pages -import docs_nav from "@src/config.yaml"; - -export interface Props { - title?: string; -} - -const { title } = Astro.props; - -// Figure out the current section -var current_section = ""; -docs_nav["nav"].forEach((section) => { - Object.values(section)[0].forEach((filename) => { - var url = "/docs/" + filename.replace(/\.md$/, "").replace(/index$/, ""); - if (Astro.url.pathname.replace(/\/$/, "") == url.replace(/\/$/, "")) { - current_section = Object.keys(section)[0]; - } - }); -}); ---- - -{current_section !== title && current_section} - -{title} diff --git a/src/config.yaml b/src/config.yaml deleted file mode 120000 index 774182cc..00000000 --- a/src/config.yaml +++ /dev/null @@ -1 +0,0 @@ -../../MultiQC/docs/config.yaml \ No newline at end of file diff --git a/src/content/config.ts b/src/content/config.ts index 55641f60..8fe8cec0 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -14,27 +14,6 @@ const reportCollection = defineCollection({ }), }); -const docsCollection = defineCollection({ - type: "content", - schema: z.object({ - title: z.string(), - description: z.string(), - order: z.number().optional(), - }), -}); - -const modulesCollection = defineCollection({ - type: "content", - schema: z.object({ - name: z.string(), - urls: z.array(z.string().url()), - summary: z.string(), - extra_description: z.string().optional(), - }), -}); - export const collections = { "example-reports": reportCollection, - docs: docsCollection, - modules: modulesCollection, }; diff --git a/src/content/docs b/src/content/docs deleted file mode 120000 index 62af59ec..00000000 --- a/src/content/docs +++ /dev/null @@ -1 +0,0 @@ -../../../MultiQC/docs/core \ No newline at end of file diff --git a/src/content/modules b/src/content/modules deleted file mode 120000 index 807756c3..00000000 --- a/src/content/modules +++ /dev/null @@ -1 +0,0 @@ -../../../MultiQC/docs/autogenerated \ No newline at end of file diff --git a/src/docs/images b/src/docs/images deleted file mode 120000 index 7fdb5900..00000000 --- a/src/docs/images +++ /dev/null @@ -1 +0,0 @@ -../../../MultiQC/docs/images \ No newline at end of file diff --git a/src/layouts/DocsLayout.astro b/src/layouts/DocsLayout.astro deleted file mode 100644 index bef703bb..00000000 --- a/src/layouts/DocsLayout.astro +++ /dev/null @@ -1,146 +0,0 @@ ---- -import BaseLayout from "@layouts/BaseLayout.astro"; -import Hero from "@components/Hero.astro"; -import MarkdownWrapper from "@components/MarkdownWrapper.svelte"; -import FooterPrevNext from "@components/FooterPrevNext.astro"; -import SidebarNav from "@components/sidebars/SidebarNav.astro"; -import SidebarSecondary from "@components/sidebars/SidebarSecondary.astro"; -import CommunityLinks from "@components/CommunityLinks.astro"; -// Fetch the config.yml that has section titles and order of pages -import docs_nav from "@src/config.yaml"; - -export interface Props { - title?: string; - subtitle?: string; - section?: string; - image?: string; - md_github_url?: string; - headings?: { - depth: number; - text: string; - slug: string; - }[]; -} -const { title, subtitle, section, image, md_github_url, headings } = Astro.props; -const community_links = [ - { - url: md_github_url, - icon: "mdi:lead-pencil", - text: "Edit this page", - }, - { - url: "https://community.seqera.io/c/multiqc/6", - icon: "mdi:forum", - text: "Community Forum", - }, - { - url: "https://github.com/MultiQC/MultiQC", - icon: "mdi:github", - text: "GitHub", - }, - { - url: "https://twitter.com/MultiQC", - icon: "mdi:twitter", - text: "Twitter", - }, - { - url: "https://mstdn.science/@multiqc", - icon: "mdi:mastodon", - text: "Mastodon", - }, -]; - -const sections: { - section: string; - pages: string[][]; -}[] = []; -let prev_page: string[]; -let next_page: string[]; -let last_page: string[]; -let last_matched = false; -const all_docs = await Astro.glob("../../../MultiQC/docs/core/**/*.{md,mdx}"); -docs_nav["nav"].forEach((section) => { - let pages: string[] = []; - Object.values(section)[0].forEach((filename) => { - var url = "/docs/" + filename.replace(/\.(md|mdx)$/, "").replace(/index$/, ""); - // add trailing slash if Astro.url.pathname has one (true for production, not for dev) - if (Astro.url.pathname.slice(-1) === "/") { - url += "/"; - } - url = url.replace(/\/\/$/, "/"); - var filtered = all_docs.filter(function (el) { - return el.file.endsWith("docs/core/" + filename); - }); - const page = [url, filtered[0]]; - pages.push(page); - // Collect prev- and next-pages - if (Astro.url.pathname == url) { - last_matched = true; - if (last_page) { - prev_page = last_page; - } - } else if (last_matched) { - next_page = page; - last_matched = false; - } - last_page = page; - }); - sections.push({ section: section, pages: pages }); -}); ---- - - - -
-

{title}

- { - section && ( -
{section}
- ) - } -

{subtitle}

-
-
-
-
- - -
- - - - -
- - -
-
- -
- - - - - diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/[...slug].astro deleted file mode 100644 index 8f2267b3..00000000 --- a/src/pages/docs/[...slug].astro +++ /dev/null @@ -1,51 +0,0 @@ ---- -import DocsLayout from "@layouts/DocsLayout.astro"; -import { getCollection } from "astro:content"; - -export async function getStaticPaths() { - const docs = await getCollection("docs"); - return docs.map((doc) => ({ - params: { - slug: doc.slug !== "index" ? doc.slug : undefined, - }, - props: { - doc: doc, - frontmatter: doc.data, - }, - })); -} - -const { doc, frontmatter } = Astro.props; -const { headings, Content, remarkPluginFrontmatter } = await doc.render(); - -const headings_filtered = headings.filter((h) => h.depth >= 2 && h.depth <= 3); - -// GitHub URL for the footer -const gh_url = "https://github.com/MultiQC/MultiQC/blob/main/docs/core/" + doc.id; - -let section = doc.slug ? doc.slug.split("/")[0] : undefined; -// get section as first element of the slug convert to title case -section = - section && - section - .replace(/_/g, " ") - .replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()) - .replace("Core", "Getting Started"); ---- - - -
- -
-
diff --git a/src/pages/index.astro b/src/pages/index.astro index 40a1fd06..67686a74 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -36,7 +36,6 @@ const latestRelease = await fetch("https://api.github.com/repos/MultiQC/MultiQC/ const exampleReports = (await getCollection("example-reports")).sort( (a, b) => a.data.priority - b.data.priority, ); -const modules = await getCollection("modules"); ---
-
- @@ -257,7 +266,7 @@ const modules = await getCollection("modules");

Need a little more help? See the full installation instructions @@ -399,14 +408,14 @@ const modules = await getCollection("modules");

See the - + installation instructions for more help.

- diff --git a/src/pages/modules/[module].astro b/src/pages/modules/[module].astro deleted file mode 100644 index e26b53ba..00000000 --- a/src/pages/modules/[module].astro +++ /dev/null @@ -1,51 +0,0 @@ ---- -import PageLayout from "@layouts/PageLayout.astro"; -import { Code } from "astro/components"; -import { parse, stringify } from "yaml"; -import { Icon } from "astro-icon/components"; -import Button from "@components/Button.svelte"; -import { getCollection } from "astro:content"; - -export async function getStaticPaths() { - const modules = await getCollection("modules"); - - return modules.map((module) => ({ - params: { - module: module.slug, - }, - props: { - module: module, - frontmatter: module.data, - }, - })); -} - -const { module, frontmatter } = Astro.props; - -const { headings, Content, remarkPluginFrontmatter } = await module.render(); -const gh_url = - "https://github.com/MultiQC/MultiQC/blob/main/docs/modules/" + module.id.split("/").pop(); ---- - - -
- -
-
- -
-
diff --git a/src/pages/modules/index.astro b/src/pages/modules/index.astro deleted file mode 100644 index 7c20c924..00000000 --- a/src/pages/modules/index.astro +++ /dev/null @@ -1,117 +0,0 @@ ---- -import PageLayout from "@layouts/PageLayout.astro"; -import { Icon } from "astro-icon/components"; -import { getCollection } from "astro:content"; - -const modules = await getCollection("modules"); ---- - - -
- -

- Click the tool name to go to the MultiQC documentation for that tool. -

-
-

- Missing something? If you would like another tool to to be support, please - - open an issue - . -

-
- -
- - -
-
-
-
Tool
- - -
- { - modules && - modules.map((module) => ( -
- -
- {module.data.summary} -
-
- )) - } -
-
- - -
diff --git a/src/pages/run.astro b/src/pages/run.astro index d1122afe..8ada2738 100644 --- a/src/pages/run.astro +++ b/src/pages/run.astro @@ -124,7 +124,8 @@ import { Icon } from "astro-icon/components";

I gave it a FastQ file, but it said no files found

That's because MultiQC uses outputs from other analysis tools, it doesn't do the analysis - itself. Check out the documentation for more details. + itself. Check out the documentation for more + details.