Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Each documentation page is built from an MDX file. Each file starts with YAML fr
- `sidebar_label`: the label that's shown in the side navigation.
- `sidebar_position`: the position of this page within its section in the side navigation.
- `slug`: used to maintain URLs from the previous documentation platform. Don't add a slug for new pages, or edit existing slugs.
- `hide_in_snapshot: true`: makes the page [unlisted](https://docusaurus.io/docs/create-doc#unlisted) in the unreleased snapshot version. An unlisted page is hidden from the side navigation, search engines, and the sitemap, and it stays reachable by its URL. The key has no effect in releases. The dev server shows the page in the side navigation, with an "Unlisted page" banner.
- `enterprise: true`, `beta: true`, or `experimental: true`: shows a badge at the top of the page. The `enterprise` and `beta` badges also show next to the page in the side navigation.

Pages in `cloud/` and `tutorials/` can also have `cloud_title`, `cloud_tags`, and `cloud_order` keys. The Hazelcast Cloud console reads them. Do not remove or rename them.
Expand Down
3 changes: 2 additions & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import {redirects} from './src/redirects';
import {docs, versionedDocs, versionedInstances, latestSegs, canonicalSitemapItems} from './src/docsPlugins';
import {docs, versionedDocs, versionedInstances, latestSegs, canonicalSitemapItems, parseFrontMatter} from './src/docsPlugins';
import {variables, versionedVariables} from './src/variables';

// Retired versions served as static Antora HTML from a separate site. See plugins/archived-versions.
Expand Down Expand Up @@ -48,6 +48,7 @@ const config: Config = {
onBrokenAnchors: 'warn',

markdown: {
parseFrontMatter,
hooks: {
onBrokenMarkdownLinks: 'throw',
onBrokenMarkdownImages: 'throw',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "Community Edition Release Notes"
sidebar_label: "Release Notes"
sidebar_position: 1
slug: /release-notes/community
hide_in_snapshot: true
---

:::important
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_label: "Release Notes"
sidebar_position: 1
slug: /release-notes/enterprise
enterprise: true
hide_in_snapshot: true
---

:::important
Expand Down
1 change: 1 addition & 0 deletions hazelcast/install-and-upgrade/releases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "Hazelcast Platform release notes"
sidebar_label: "Release Notes"
sidebar_position: 2
slug: /release-notes/releases
hide_in_snapshot: true
---

:::important
Expand Down
1 change: 1 addition & 0 deletions management-center/install-and-upgrade/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: "Release Notes"
sidebar_position: 3
slug: /release-notes/release-notes
hide_in_snapshot: true
---

These release notes list any new features, enhancements, fixes, security issues and breaking changes that were made for Hazelcast Management Center.
Expand Down
1 change: 1 addition & 0 deletions operator/get-started/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: "Release notes"
sidebar_position: 3
slug: /release-notes
hide_in_snapshot: true
---

These release notes list any new features, enhancements, fixes, and breaking changes implemented between version 5.19.0 and version 5.20.0 of Hazelcast Platform Operator.
Expand Down
13 changes: 12 additions & 1 deletion src/docsPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// <id>_versioned_sidebars/ sidebar stubs, gitignored (see ensureVersionedSidebars)
import fs from 'fs';
import path from 'path';
import type {PluginConfig} from '@docusaurus/types';
import type {ParseFrontMatter, PluginConfig} from '@docusaurus/types';
import type {Options} from '@docusaurus/plugin-content-docs';
import latestLinks, {type LatestSegs} from './remark/latestLinks';
import headingVariables from './remark/headingVariables';
Expand Down Expand Up @@ -48,6 +48,17 @@ export function canonicalSitemapItems<T extends {url: string}>(items: T[]): T[]
});
}

// `markdown.parseFrontMatter` hook: a page with `hide_in_snapshot: true` in a component's unreleased snapshot becomes `unlisted`.
// The release script copies frontmatter into each release, so writing `unlisted` in the file would hide the page in releases too.
export const parseFrontMatter: ParseFrontMatter = async (params) => {
const result = await params.defaultParseFrontMatter(params);
const [id] = path.relative(siteDir, params.filePath).split(path.sep);
if (result.frontMatter.hide_in_snapshot === true && id !== undefined && id in snapshotSegs) {
result.frontMatter.unlisted = true;
Comment thread
mscwilson marked this conversation as resolved.
Resolved
}
return result;
};

// `caution`/`important` are not default Docusaurus admonition keywords; fidelity Layer 2 compares admonition types.
const admonitions = {keywords: ['caution', 'important'], extendDefaults: true};

Expand Down
15 changes: 15 additions & 0 deletions src/test/docsPlugins.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ test('a category takes the badge of its landing page, nested items are tagged, a
assert.equal(noLanding.items[0].className, 'nav-badge-beta')
})

test('hide_in_snapshot makes a page unlisted in an unreleased snapshot only', async () => {
const unlisted = async (file, frontMatter = {hide_in_snapshot: true}) => {
const {frontMatter: parsed} = await docsPlugins.parseFrontMatter({
filePath: path.join(site, file),
fileContent: '',
defaultParseFrontMatter: async () => ({frontMatter: {...frontMatter}, content: ''}),
})
return parsed.unlisted === true
}
assert.equal(await unlisted('hazelcast/page.mdx'), true, 'snapshot main')
assert.equal(await unlisted('hazelcast_versioned_docs/version-5.7/page.mdx'), false, 'release')
assert.equal(await unlisted('clc/page.mdx'), false, 'main that is the newest release')
assert.equal(await unlisted('hazelcast/page.mdx', {}), false, 'no flag')
})

// Version names are dotted numbers, compared numerically: 5.10 is newer than 5.9.
const compareVersions = (a, b) => {
const pa = a.split('.').map(Number)
Expand Down
15 changes: 15 additions & 0 deletions src/theme/ContentVisibility/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, {type ReactNode} from 'react';
import ContentVisibility from '@theme-original/ContentVisibility';
import type ContentVisibilityType from '@theme/ContentVisibility';
import type {WrapperProps} from '@docusaurus/types';
import {UnlistedMetadata} from '@docusaurus/theme-common';

type Props = WrapperProps<typeof ContentVisibilityType>;

// Shows the unlisted banner in development environments only
export default function ContentVisibilityWrapper(props: Props): ReactNode {
if (process.env.NODE_ENV === 'production') {
return props.metadata.unlisted ? <UnlistedMetadata /> : null;
}
return <ContentVisibility {...props} />;
}
Loading