« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write/build-modes/static-build.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/write/build-modes/static-build.js')
-rw-r--r--src/write/build-modes/static-build.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js
index d40e1cb7..7eb73474 100644
--- a/src/write/build-modes/static-build.js
+++ b/src/write/build-modes/static-build.js
@@ -27,6 +27,7 @@ import {
 } from '#cli';
 
 import {
+  getOrigin,
   getPagePathname,
   getURLsFrom,
   getURLsFromRoot,
@@ -321,7 +322,7 @@ export async function go({
           language,
           pagePath,
           pagePathStringFromRoot: pathname,
-          to,
+          to: page.absoluteLinks ? absoluteTo : to,
         });
 
         let pageHTML, oEmbedJSON;
@@ -436,12 +437,18 @@ async function writePage({
   ].filter(Boolean));
 }
 
+function filterNoOrigin(route) {
+  return !getOrigin(route.to);
+}
+
 function writeWebRouteSymlinks({
   outputPath,
   webRoutes,
 }) {
   const symlinkRoutes =
-    webRoutes.filter(route => route.statically === 'symlink');
+    webRoutes
+      .filter(route => route.statically === 'symlink')
+      .filter(filterNoOrigin);
 
   const promises =
     symlinkRoutes.map(async route => {
@@ -481,7 +488,9 @@ async function writeWebRouteCopies({
   webRoutes,
 }) {
   const copyRoutes =
-    webRoutes.filter(route => route.statically === 'copy');
+    webRoutes
+      .filter(route => route.statically === 'copy')
+      .filter(filterNoOrigin);
 
   const promises =
     copyRoutes.map(async route => {