Skip to content

Commit

Permalink
feat: add redirect url for non-lang mode
Browse files Browse the repository at this point in the history
  • Loading branch information
makamekm committed Apr 1, 2024
1 parent 286fb30 commit 8c40c77
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/steps/processPages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {DocInnerProps} from '@diplodoc/client';
import {basename, dirname, extname, join, relative, resolve} from 'path';
import shell from 'shelljs';
import {readFileSync, writeFileSync} from 'fs';
import {existsSync, readFileSync, writeFileSync} from 'fs';
import {bold} from 'chalk';
import {dump, load} from 'js-yaml';
import {asyncify, mapLimit} from 'async';
Expand Down Expand Up @@ -193,9 +193,11 @@ function saveRedirectPage(pathData: {outputBundlePath: string; outputDir: string

const relativeOutputBundlePath = relative(outputFolderPath, outputBundlePath);
const redirectPagePath = join(outputDir, 'index.html');
const content = generateStaticRedirect(lang || Lang.RU, relativeOutputBundlePath);

writeFileSync(redirectPagePath, content);
if (!existsSync(redirectPagePath)) {
const content = generateStaticRedirect(lang || Lang.RU, relativeOutputBundlePath);
writeFileSync(redirectPagePath, content);
}
}

function savePageResultForSinglePage(pageProps: DocInnerProps, pathData: PathData): void {
Expand Down

0 comments on commit 8c40c77

Please sign in to comment.