-
Notifications
You must be signed in to change notification settings - Fork 102
Move the CLI reference to its own top level section #3431
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e668972
Move the CLI reference to its own top level section
enf0rc3 07e39aa
Route /docs/cli to the CLI tab
enf0rc3 07560a5
Fill the promotion shortlist with candidates it can be chosen from
enf0rc3 ef720a6
Merge branch 'main' into willlaugesen/move-cli-to-top-level
borland 3d9a18e
Keep a redirect at the root of each moved folder, not on every page
enf0rc3 d7dbbb1
Serve the old CLI urls from the redirect config rather than stub files
enf0rc3 63f40d0
Remove the api-and-integration redirects to the Octo CLI
enf0rc3 e8f3c6e
Redirect the two old CLI section urls from pages, not from the config
enf0rc3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,7 +78,8 @@ | |
| "type": "choice", | ||
| "choices": [ | ||
| "docs", | ||
| "api" | ||
| "api", | ||
| "cli" | ||
| ], | ||
| "required": false | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| import { accelerator } from '@lib/accelerator'; | ||
| import { Translations, Lang } from '@util/Languages'; | ||
| import { areaMenu } from '@lib/areaMenu'; | ||
| import AreaNavigationItem from './AreaNavigationItem.astro'; | ||
|
|
||
| const stats = new accelerator.statistics('components/CliNavigation.astro'); | ||
| stats.start(); | ||
|
|
||
| type Props = { | ||
| lang: string; | ||
| }; | ||
| const { lang } = Astro.props satisfies Props; | ||
|
|
||
| const _ = Lang(lang); | ||
|
|
||
| const currentPath = Astro.url.pathname.replace(/\/$/, ''); | ||
|
|
||
| // The hand-written pages first — the overview and the deprecated Octo CLI — | ||
| // then the generated command reference, with a rule between them. | ||
| // | ||
| // Unlike the API nav there is no third level: a command page has no endpoints | ||
| // under it, so the rows are handed an empty list and each one renders as a | ||
| // plain link. | ||
| const { authored, generated } = areaMenu('cli'); | ||
|
|
||
| stats.stop(); | ||
| --- | ||
|
|
||
| <nav | ||
| class="site-nav" | ||
| id="site-nav" | ||
| aria-label={_(Translations.aria.site_navigation)} | ||
| > | ||
| <h2 class="site-nav-title">{_(Translations.navigation.title)}</h2> | ||
| <ul class="site-nav__list" data-site-nav-scroll> | ||
| { | ||
| authored.map((page) => ( | ||
| <AreaNavigationItem | ||
| page={page} | ||
| currentPath={currentPath} | ||
| endpoints={[]} | ||
| methodLabels={{}} | ||
| /> | ||
| )) | ||
| } | ||
| { | ||
| authored.length > 0 && generated.length > 0 && ( | ||
| <li class="site-nav__list-item"> | ||
| {/* The two halves of the nav are written by different hands, and the | ||
| rule is where one set of pages stops and the other starts. */} | ||
| <hr class="site-nav__separator" /> | ||
| </li> | ||
| ) | ||
| } | ||
| { | ||
| generated.map((page) => ( | ||
| <AreaNavigationItem | ||
| page={page} | ||
| currentPath={currentPath} | ||
| endpoints={[]} | ||
| methodLabels={{}} | ||
| /> | ||
| )) | ||
| } | ||
| </ul> | ||
| </nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| --- | ||
| import { accelerator } from '@lib/accelerator'; | ||
| import { PostFiltering } from 'astro-accelerator-utils'; | ||
| import type { Frontmatter as OriginalFrontmatter } from 'astro-accelerator-utils/types/Frontmatter'; | ||
| import { SITE } from '@config'; | ||
| import type { Crumb } from '@util/breadcrumbs'; | ||
| import { buildAreaCrumbs, resolveArea, type Area } from '@lib/areas'; | ||
| import { searchIndexAttributes } from '@lib/searchIndexing'; | ||
|
|
||
| // Theme components | ||
| import Head from '@components/HtmlHead.astro'; | ||
| import SkipLinks from '@components/SkipLinks.astro'; | ||
| import Breadcrumbs from '@components/Breadcrumbs.astro'; | ||
| import Authors from '@components/Authors.astro'; | ||
| import Taxonomy from '@components/Taxonomy.astro'; | ||
|
|
||
| // Custom components | ||
| import AreaNavigation from '../components/AreaNavigation.astro'; | ||
| import ArticleHeader from '../components/ArticleHeader.astro'; | ||
| import ArticleNav from '../components/ArticleNav.astro'; | ||
| import Feedback from '../components/Feedback.astro'; | ||
| import TopNav from '../components/TopNav.astro'; | ||
| import CopyAsMarkdown from '../components/CopyAsMarkdown.astro'; | ||
| import OpenInLlm from '../components/OpenInLlm.astro'; | ||
| import Plausible from 'src/components/Plausible.astro'; | ||
| import Footer from 'src/components/Footer.astro'; | ||
| import DocsSearch from '../components/DocsSearch.astro'; | ||
|
|
||
| // The layout for the generated CLI reference, the counterpart to Api.astro. | ||
| // Every page under /docs/cli/_generated names it, so the reference can be | ||
| // restyled without touching the hand-written pages beside it. | ||
| // | ||
| // It is laid out as a docs page: the middle column, the area nav and the table | ||
| // of contents beside it. When the reference needs a look of its own, it changes | ||
| // here and all 185 pages pick it up. | ||
| // | ||
| // There is no "Edit on GitHub". These pages are written by gen-docs in | ||
| // OctopusDeploy/cli and land in _generated, so the file the button would open is | ||
| // overwritten by the next sync; correcting one of them means changing the | ||
| // template in that repo. Api.astro leaves it out for the same reason. | ||
| // | ||
| // Copy as markdown stays, because these pages do have a .md version to copy. | ||
| // Api.astro has it turned off only because it does not work there yet. | ||
|
|
||
| type Props = { | ||
| // The nav this page appears in. Optional, and normally left alone: these | ||
| // pages live under /docs/cli, which is the CLI area already. | ||
| frontmatter: OriginalFrontmatter & { area?: Area }; | ||
| headings: { depth: number; slug: string; text: string }[]; | ||
| breadcrumbs?: Crumb[] | null; | ||
| }; | ||
| const { frontmatter, headings, breadcrumbs } = Astro.props satisfies Props; | ||
|
|
||
| const area = resolveArea(frontmatter.area, Astro.url.pathname); | ||
| const crumbs = buildAreaCrumbs(Astro.url, area, breadcrumbs); | ||
|
|
||
| const lang = frontmatter.lang ?? SITE.default.lang; | ||
| const textDirection = frontmatter.dir ?? SITE.default.dir; | ||
|
|
||
| const title = await accelerator.markdown.getInlineHtmlFrom( | ||
| frontmatter.title ?? SITE.title | ||
| ); | ||
|
|
||
| const subtitle = frontmatter.subtitle | ||
| ? await accelerator.markdown.getInlineHtmlFrom(frontmatter.subtitle) | ||
| : null; | ||
|
|
||
| const site_url = SITE.url; | ||
| const site_features = SITE.featureFlags; | ||
| const search = | ||
| accelerator.posts.all().filter(PostFiltering.isSearch).shift() ?? null; | ||
| const searchUrl = search && accelerator.urlFormatter.formatAddress(search.url); | ||
| const isSearchPage = | ||
| accelerator.urlFormatter.formatAddress(Astro.url.pathname) === searchUrl; | ||
|
|
||
| // Gates the header's search field only. The overlay below is always rendered: | ||
| // /docs/search has its own field and opens that same overlay. | ||
| const showSearch = !isSearchPage; | ||
|
|
||
| // The footer prints this; JSON-LD carries it as dateModified. | ||
| const lastUpdated = frontmatter.modDate ?? frontmatter.pubDate ?? null; | ||
|
|
||
| const searchIndex = searchIndexAttributes(Astro.url.pathname, frontmatter); | ||
| --- | ||
|
|
||
| <html | ||
| dir={textDirection} | ||
| lang={lang} | ||
| class="initial" | ||
| data-theme="light" | ||
| data-signed-in="false" | ||
| > | ||
| <Head | ||
| frontmatter={frontmatter} | ||
| headings={headings} | ||
| lang={lang} | ||
| crumbs={crumbs} | ||
| /> | ||
| <body> | ||
| <SkipLinks frontmatter={frontmatter} headings={headings} lang={lang} /> | ||
| <TopNav lang={lang} showSearch={showSearch} /> | ||
| <div class="content-group"> | ||
| <main id="site-main"> | ||
| <Breadcrumbs lang={lang} crumbs={crumbs} /> | ||
| <article {...searchIndex.article}> | ||
| <ArticleHeader lang={lang} subtitle={subtitle} title={title} /> | ||
| <div class="page-actions"> | ||
| <CopyAsMarkdown lang={lang} /> | ||
| <OpenInLlm lang={lang} /> | ||
| </div> | ||
| <div class="page-content anim-show-parent" {...searchIndex.content}> | ||
| <slot /> | ||
| <Authors frontmatter={frontmatter} lang={lang} /> | ||
| <Taxonomy frontmatter={frontmatter} lang={lang} /> | ||
| </div> | ||
| </article> | ||
| </main> | ||
| { | ||
| /* The nav belongs to the area, not to this layout. The page's own | ||
| headings are not passed: the side column below lists them. */ | ||
| } | ||
| <AreaNavigation area={area} lang={lang} /> | ||
| <div class="side-nav"> | ||
| <ArticleNav headings={headings} lang={lang} /> | ||
| <Feedback frontmatter={frontmatter} lang={lang} /> | ||
| </div> | ||
| <Footer lang={lang} lastUpdated={lastUpdated} /> | ||
| </div> | ||
| <DocsSearch /> | ||
| <script define:vars={{ site_url, site_features }}> | ||
| window.site_url = site_url; | ||
| window.site_features = site_features; | ||
| </script> | ||
| <script> | ||
| import '../scripts/main.js'; | ||
| </script> | ||
| <Plausible /> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as Default.astro, but drops the edit in github button, opted for brand new template, because eventually i assume this will have more layout changes