Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions apify-docs-theme/src/theme/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useLocation } from '@docusaurus/router';
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import { usePluginData } from '@docusaurus/useGlobalData';
import React from 'react';

import { absoluteUrl } from '../../absoluteUrl';

export default function LayoutWrapper(props) {
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
const baseUrl = useBaseUrl('/');
const { siteConfig: { customFields } } = useDocusaurusContext();
const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '').trim();
const shouldRenderAlternateLink = currentPath && currentPath !== '404';

Expand All @@ -19,7 +19,7 @@ export default function LayoutWrapper(props) {
<Head>
{
shouldRenderAlternateLink
? <link rel="alternate" type="text/markdown" href={`${absoluteUrl}/${currentPath}.md`}/>
? <link rel="alternate" type="text/markdown" href={`${customFields.absoluteUrl}/${currentPath}.md`}/>
: null
}
</Head>
Expand Down
1 change: 1 addition & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ module.exports = {
'^/legal/*',
],
...config.customFields ?? [],
absoluteUrl: config.absoluteUrl,
},
clientModules: ['./clientModule.js'],
};