@apify/docs-theme 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config.js +0 -3
- package/src/theme/Footer/LinkItem/index.js +40 -0
- package/src/theme/NotFound.jsx +0 -52
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -218,14 +218,11 @@ const themeConfig = ({
|
|
|
218
218
|
{
|
|
219
219
|
label: 'Cralwee',
|
|
220
220
|
to: 'https://crawlee.dev',
|
|
221
|
-
target: '_self',
|
|
222
221
|
rel: 'dofollow',
|
|
223
222
|
},
|
|
224
223
|
{
|
|
225
224
|
label: 'GitHub',
|
|
226
225
|
href: 'https://github.com/apify',
|
|
227
|
-
target: '_self',
|
|
228
|
-
rel: 'dofollow',
|
|
229
226
|
},
|
|
230
227
|
],
|
|
231
228
|
},
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Link from '@docusaurus/Link';
|
|
3
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
4
|
+
import isInternalUrl_ from '@docusaurus/isInternalUrl';
|
|
5
|
+
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
6
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
7
|
+
|
|
8
|
+
export default function FooterLinkItem({ item }) {
|
|
9
|
+
const {
|
|
10
|
+
to,
|
|
11
|
+
href,
|
|
12
|
+
label,
|
|
13
|
+
prependBaseUrlToHref,
|
|
14
|
+
...props
|
|
15
|
+
} = item;
|
|
16
|
+
const toUrl = useBaseUrl(to);
|
|
17
|
+
const normalizedHref = useBaseUrl(href, { forcePrependBaseUrl: true });
|
|
18
|
+
const { siteConfig } = useDocusaurusContext();
|
|
19
|
+
const isInternalUrl = (url) => {
|
|
20
|
+
if (url.startsWith(siteConfig.url)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return isInternalUrl_(url);
|
|
24
|
+
};
|
|
25
|
+
return (
|
|
26
|
+
<Link
|
|
27
|
+
className="footer__link-item"
|
|
28
|
+
{...(href
|
|
29
|
+
? {
|
|
30
|
+
href: prependBaseUrlToHref ? normalizedHref : href
|
|
31
|
+
}
|
|
32
|
+
: {
|
|
33
|
+
to: toUrl
|
|
34
|
+
})}
|
|
35
|
+
{...props}>
|
|
36
|
+
{label}
|
|
37
|
+
{href && !isInternalUrl(href) && <IconExternalLink />}
|
|
38
|
+
</Link>
|
|
39
|
+
);
|
|
40
|
+
}
|
package/src/theme/NotFound.jsx
CHANGED
|
@@ -1,49 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
3
|
-
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
4
2
|
import { PageMetadata } from '@docusaurus/theme-common';
|
|
5
|
-
import Link from '@docusaurus/Link';
|
|
6
3
|
import Layout from '@theme/Layout';
|
|
7
4
|
|
|
8
5
|
export default function NotFound() {
|
|
9
|
-
const redirectedV2Url = useBaseUrl('/docs/api');
|
|
10
|
-
const redirectedV1Url = useBaseUrl('/docs/1.3.1/api');
|
|
11
|
-
const baseUrlForV2Redirect = useBaseUrl(`/docs/2.3/api/`);
|
|
12
|
-
const baseUrlForV1Redirect = useBaseUrl(`/docs/1.3/api/`);
|
|
13
|
-
const isBrowser = useIsBrowser();
|
|
14
|
-
|
|
15
|
-
if (isBrowser) {
|
|
16
|
-
const path = window.location.pathname;
|
|
17
|
-
let href = '';
|
|
18
|
-
let redirect = false;
|
|
19
|
-
|
|
20
|
-
if (path.startsWith(redirectedV2Url)) {
|
|
21
|
-
href = baseUrlForV2Redirect + path.substring(redirectedV2Url.length + 1);
|
|
22
|
-
redirect = true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (path.match(/\/docs\/2\.\d+\.\d+\/api/)) {
|
|
26
|
-
href = baseUrlForV2Redirect + path.substring(redirectedV1Url.length + 1);
|
|
27
|
-
redirect = true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (path.match(/\/api\/[12]\.\d+\/\w+/)) {
|
|
31
|
-
const [, v, id] = path.match(/\/api\/([12])\.\d+\/(.*)/);
|
|
32
|
-
href = (v === '1' ? baseUrlForV1Redirect : baseUrlForV2Redirect) + id;
|
|
33
|
-
redirect = true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (path.match(/\/docs\/[01]\.\d+\.\d+\/api\/(.*)/)) {
|
|
37
|
-
const id = path.match(/\/docs\/[01]\.\d+\.\d+\/api\/(.*)/)[1];
|
|
38
|
-
href = baseUrlForV1Redirect + id;
|
|
39
|
-
redirect = true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (redirect && window.location.href !== href) {
|
|
43
|
-
window.location.href = href;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
6
|
return (
|
|
48
7
|
<>
|
|
49
8
|
<PageMetadata title={'Page Not Found'} />
|
|
@@ -57,17 +16,6 @@ export default function NotFound() {
|
|
|
57
16
|
<p>
|
|
58
17
|
We could not find what you were looking for 😢
|
|
59
18
|
</p>
|
|
60
|
-
<p>
|
|
61
|
-
Recently we <b>released Apify SDK v3 </b>
|
|
62
|
-
and we significantly upgraded the documentation.
|
|
63
|
-
</p>
|
|
64
|
-
<p>
|
|
65
|
-
If you're looking for documentation of <b>Apify SDK v2</b>,
|
|
66
|
-
<Link to={'/docs/2.3/guides/apify-platform'}> you can find it here</Link>.
|
|
67
|
-
</p>
|
|
68
|
-
<p>
|
|
69
|
-
For <b>Apify SDK v3 docs</b>, go to the <Link to={'/'}>homepage</Link>.
|
|
70
|
-
</p>
|
|
71
19
|
</div>
|
|
72
20
|
</div>
|
|
73
21
|
</main>
|