Skip to content

Commit 26ee96a

Browse files
authored
Display the outdated docs banner (#1629)
* Always display the outdated docs banner * Disable announcement banner
1 parent b46c060 commit 26ee96a

File tree

17 files changed

+40
-25
lines changed

17 files changed

+40
-25
lines changed

gatsby-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require('dotenv').config({
77
path: `.env.${process.env.NODE_ENV}`,
88
});
99

10-
const shouldAnnouncementBannerBeShown = true;
10+
const shouldAnnouncementBannerBeShown = false;
1111

1212
const plugins = [
1313
'gatsby-transformer-sharp',

src/components/shared/page-info/page-info.module.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
.container {
22
margin-bottom: 20px;
3-
margin-top: 115px;
3+
//margin-top: 115px;
4+
margin-top: 165px;
45

56
@include xl-down {
67
margin-top: 160px;
78
}
89

910
@include lg-down {
11+
margin-top: 205px;
1012
margin-bottom: 20px;
1113
}
1214

1315
@include sm-down {
14-
margin-top: 230px;
16+
//margin-top: 230px;
17+
margin-top: 240px;
1518
}
1619

1720
&.wide {

src/components/shared/version-banner/version-banner.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
import React from 'react';
2-
import { LATEST_VERSION } from 'utils/versioning';
2+
// import { LATEST_VERSION } from 'utils/versioning';
33

44
import styles from './version-banner.module.scss';
55

6-
export const VersionBanner = ({ version, versions }) => (
6+
export const VersionBanner = ({ canonicalUrl }) => (
77
<div className={styles.wrapper}>
88
<div className={'container'}>
99
<div className={styles.inner}>
1010
<span className={styles.message}>
11-
⚠️ This is the archived documentation for k6 <b>{version}</b>.
12-
{typeof versions[LATEST_VERSION] !== 'undefined' && (
13-
<span>
14-
{' '}
15-
Go to the{' '}
16-
<a
17-
href="https://grafana.com/docs/k6/latest/"
18-
target="_blank"
19-
rel="noreferrer"
20-
>
21-
latest version
22-
</a>
23-
.
24-
</span>
25-
)}
11+
⚠️ This documentation is outdated. Please visit grafana.com for the{' '}
12+
<a href={canonicalUrl || 'https://grafana.com/docs/k6/latest/'}>
13+
latest k6 documentation
14+
</a>
15+
.📚
2616
</span>
2717
</div>
2818
</div>

src/components/shared/version-banner/version-banner.module.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.wrapper {
2-
margin: 140px 0 -145px 0;
2+
//margin: 140px 0 -145px 0;
3+
margin: 100px 0 -145px 0;
34

45
@include sm-down {
56
display: flex;

src/components/templates/doc-page/doc-page.module.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
.container {
2-
margin-top: 100px;
2+
//margin-top: 100px;
3+
margin-top: 165px;
34
position: relative;
45
@include xl-down {
56
margin-top: 185px;
67
}
78
@include sm-down {
8-
margin-top: 250px;
9+
//margin-top: 250px;
10+
margin-top: 240px;
911
width: 540px;
1012
margin-left: auto;
1113
margin-right: auto;

src/layouts/doc-layout/doc-layout.view.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export const DocLayout = ({
252252
sidebarTree,
253253
navLinks: links,
254254
children,
255+
canonicalUrl,
255256
pageVersions = {},
256257
sectionName = null,
257258
path,
@@ -308,7 +309,9 @@ export const DocLayout = ({
308309

309310
if (sidebarRef && sidebarRef.current && sidebarScrollValue) {
310311
setTimeout(() => {
311-
sidebarRef.current.scrollTop = parseInt(sidebarScrollValue, 10);
312+
if (sidebarRef && sidebarRef.current && sidebarScrollValue) {
313+
sidebarRef.current.scrollTop = parseInt(sidebarScrollValue, 10);
314+
}
312315
}, 0);
313316
}
314317
}, [sidebarRef]);
@@ -419,7 +422,11 @@ export const DocLayout = ({
419422
</div>
420423
</div>
421424
</Header>
422-
{version && <VersionBanner version={version} versions={pageVersions} />}
425+
<VersionBanner
426+
canonicalUrl={canonicalUrl}
427+
version={version}
428+
versions={pageVersions}
429+
/>
423430

424431
{children}
425432
<MobileNav

src/templates/doc-page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const DocPage = (props) => {
7777
pageVersions={pageVersions}
7878
path={path}
7979
sectionName={sectionName}
80+
canonicalUrl={frontmatter.canonicalUrl}
8081
>
8182
<div
8283
className={classNames(

src/templates/docs/bundle-builder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const BundleBuilderPage = ({ pageContext: { sidebarTree, navLinks } }) => {
5959
sidebarTree={sidebarTree}
6060
navLinks={navLinks}
6161
sectionName="Extensions"
62+
canonicalUrl={SeoMetaData['bundle-builder'].data.canonicalUrl}
6263
>
6364
<ExtensionsTitleGroup
6465
title={'Bundle'}

src/templates/docs/cloud.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const Cloud = ({ pageContext: { sidebarTree, navLinks } }) => {
3333
sidebarTree={sidebarTree}
3434
navLinks={navLinks}
3535
sectionName="Cloud"
36+
canonicalUrl={SeoMetaData.cloud.data.canonicalUrl}
3637
>
3738
<PageInfo title={'k6 Cloud documentation'} />
3839
<div className={`${docPageContent.inner}`}>

src/templates/docs/examples.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const Examples = ({ pageContext: { sidebarTree, navLinks } }) => {
4646
sidebarTree={sidebarTree}
4747
navLinks={navLinks}
4848
sectionName="Examples"
49+
canonicalUrl={SeoMetaData.examples.data.canonicalUrl}
4950
>
5051
<PageInfo
5152
title={'Examples & Tutorials'}

0 commit comments

Comments
 (0)