Skip to content

Commit 160f283

Browse files
committed
fix: Get absoluteUrl from docusaurus context
1 parent 552fe44 commit 160f283

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

apify-docs-theme/src/theme/Layout/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { useLocation } from '@docusaurus/router';
33
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
44
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
55
import useBaseUrl from '@docusaurus/useBaseUrl';
6+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
67
import { usePluginData } from '@docusaurus/useGlobalData';
78
import React from 'react';
89

9-
import { absoluteUrl } from '../../absoluteUrl';
10-
1110
export default function LayoutWrapper(props) {
1211
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
1312
const baseUrl = useBaseUrl('/');
13+
const { siteConfig: { customFields } } = useDocusaurusContext();
1414
const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '').trim();
1515
const shouldRenderAlternateLink = currentPath && currentPath !== '404';
1616

@@ -19,7 +19,7 @@ export default function LayoutWrapper(props) {
1919
<Head>
2020
{
2121
shouldRenderAlternateLink
22-
? <link rel="alternate" type="text/markdown" href={`${absoluteUrl}/${currentPath}.md`}/>
22+
? <link rel="alternate" type="text/markdown" href={`${customFields.absoluteUrl}/${currentPath}.md`}/>
2323
: null
2424
}
2525
</Head>

docusaurus.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ module.exports = {
538538
'^/legal/*',
539539
],
540540
...config.customFields ?? [],
541+
absoluteUrl: config.absoluteUrl,
541542
},
542543
clientModules: ['./clientModule.js'],
543544
};

0 commit comments

Comments
 (0)