Skip to content
Merged
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
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 @@ -6,20 +6,20 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
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 currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '').trim();
const shouldRenderAlternateLink = currentPath && currentPath !== '404';

const alternateMarkdownLink = useBaseUrl(`/${currentPath}.md`, { absolute: true });

return (
<>
<Head>
{
shouldRenderAlternateLink
? <link rel="alternate" type="text/markdown" href={`${absoluteUrl}/${currentPath}.md`}/>
? <link rel="alternate" type="text/markdown" href={alternateMarkdownLink}/>
: null
}
</Head>
Expand Down