Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions apify-docs-theme/src/absoluteUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let absoluteUrl = 'https://docs.apify.com';

if (process.env.LOCALHOST) {
absoluteUrl = 'http://localhost:3000';
} else if (process.env.DEV) {
absoluteUrl = 'http://docs.apify.loc';
} else if (process.env.APIFY_DOCS_ABSOLUTE_URL) {
absoluteUrl = process.env.APIFY_DOCS_ABSOLUTE_URL;
}

exports.absoluteUrl = absoluteUrl;
11 changes: 1 addition & 10 deletions apify-docs-theme/src/config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/* eslint-disable global-require */

let absoluteUrl = 'https://docs.apify.com';

if (process.env.LOCALHOST) {
absoluteUrl = 'http://localhost:3000';
} else if (process.env.DEV) {
absoluteUrl = 'http://docs.apify.loc';
} else if (process.env.APIFY_DOCS_ABSOLUTE_URL) {
absoluteUrl = process.env.APIFY_DOCS_ABSOLUTE_URL;
}
const { absoluteUrl } = require('./absoluteUrl');

const noIndex = ['true', '1'].includes(process.env.NO_INDEX ?? '');

Expand Down
4 changes: 3 additions & 1 deletion apify-docs-theme/src/theme/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ 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('/');
Expand All @@ -17,7 +19,7 @@ export default function LayoutWrapper(props) {
<Head>
{
shouldRenderAlternateLink
? <link rel="alternate" type="text/markdown" href={`${currentPath}.md`}/>
? <link rel="alternate" type="text/markdown" href={`${absoluteUrl}/${currentPath}.md`}/>
: null
}
</Head>
Expand Down