diff options
Diffstat (limited to 'src/write/build-modes')
-rw-r--r-- | src/write/build-modes/live-dev-server.js | 23 | ||||
-rw-r--r-- | src/write/build-modes/static-build.js | 24 |
2 files changed, 17 insertions, 30 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js index b6bf662b..a5d9da97 100644 --- a/src/write/build-modes/live-dev-server.js +++ b/src/write/build-modes/live-dev-server.js @@ -11,10 +11,10 @@ import {serializeThings} from '../../data/serialize.js'; import * as pageSpecs from '../../page/index.js'; import {logInfo, logWarn, progressCallAll} from '../../util/cli.js'; -import {withEntries} from '../../util/sugar.js'; import { getPagePathname, + getPagePathnameAcrossLanguages, getPageSubdirectoryPrefix, getURLsFrom, getURLsFromRoot, @@ -280,20 +280,13 @@ export async function go({ response.writeHead(200, contentTypeHTML); - const localizedPathnames = withEntries(languages, entries => entries - .filter(([key, language]) => key !== 'default' && !language.hidden) - .map(([_key, language]) => [ - language.code, - getPagePathname({ - baseDirectory: - (language === defaultLanguage - ? '' - : language.code), - fullKey: 'localized.' + pageSubKey, - urlArgs, - urls, - }), - ])); + const localizedPathnames = getPagePathnameAcrossLanguages({ + defaultLanguage, + languages, + pageSubKey, + urlArgs, + urls, + }); const bound = bindUtilities({ absoluteTo, diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js index bbf97085..0e8c4b07 100644 --- a/src/write/build-modes/static-build.js +++ b/src/write/build-modes/static-build.js @@ -15,7 +15,7 @@ import {serializeThings} from '../../data/serialize.js'; import * as pageSpecs from '../../page/index.js'; import link from '../../util/link.js'; -import {empty, queue, withEntries} from '../../util/sugar.js'; +import {empty, queue} from '../../util/sugar.js'; import { logError, @@ -27,6 +27,7 @@ import { import { getPagePathname, + getPagePathnameAcrossLanguages, getPageSubdirectoryPrefix, getURLsFrom, getURLsFromRoot, @@ -268,20 +269,13 @@ export async function go({ const urlArgs = page.path.slice(1); const fullKey = 'localized.' + pageSubKey; - const localizedPathnames = withEntries(languages, entries => entries - .filter(([key, language]) => key !== 'default' && !language.hidden) - .map(([_key, language]) => [ - language.code, - getPagePathname({ - baseDirectory: - (language === defaultLanguage - ? '' - : language.code), - fullKey, - urlArgs, - urls, - }), - ])); + const localizedPathnames = getPagePathnameAcrossLanguages({ + defaultLanguage, + languages, + pageSubKey, + urlArgs, + urls, + }); const pathname = getPagePathname({ baseDirectory, |