From 974923aee277094a0c3cf0f15726a30488f7cfbc Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 16:59:43 +0100 Subject: [PATCH 01/17] fix: add publicPath auto for subfolder hosting support --- webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webpack.config.js b/webpack.config.js index e069e11..adba07f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -332,6 +332,7 @@ module.exports = async (_, { mode = 'development' }) => ({ output: { filename: '[name].js', path: path.resolve(__dirname, 'dist'), + publicPath: 'auto', clean: true, }, plugins: [ From 9174e80c562dbe20436f05fedec194c18b1afde5 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:05:32 +0100 Subject: [PATCH 02/17] fix: add basePath support for subfolder hosting --- webpack.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index adba07f..94d4e3d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -311,6 +311,7 @@ const mediaMentionsConfig = [ }, ]; const BASE_URL = 'https://programming.org.ua'; +const BASE_PATH = process.env.BASE_PATH || ''; module.exports = async (_, { mode = 'development' }) => ({ entry: { @@ -399,6 +400,7 @@ module.exports = async (_, { mode = 'development' }) => ({ translations, locale, langPrefix, + basePath: BASE_PATH, relativePagePath, canonicalUrl: `${BASE_URL}${filenamePrefix}${relativePagePath}`, alternativeLocales: alternativeLocales.map(({ langPrefix, lang }) => ({ From 81b65c3d1d038f27fe8b2d9001018220ff1a2cf0 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:05:33 +0100 Subject: [PATCH 03/17] fix: add basePath support for subfolder hosting --- src/template-partials/meta.hbs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/template-partials/meta.hbs b/src/template-partials/meta.hbs index fb92c0a..ca949f1 100644 --- a/src/template-partials/meta.hbs +++ b/src/template-partials/meta.hbs @@ -16,10 +16,10 @@ - - - - + + + + {{ pageTranslations.meta.title }} {{#each htmlWebpackPlugin.options.content.alternativeLocales}} From 9081b5dbdbafd9c42284356fa2be726ab02652eb Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:05:34 +0100 Subject: [PATCH 04/17] fix: add basePath support for subfolder hosting --- src/header/header.hbs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/header/header.hbs b/src/header/header.hbs index 5224588..f934bb3 100644 --- a/src/header/header.hbs +++ b/src/header/header.hbs @@ -67,13 +67,13 @@ From b433b81a33f4fa1f40a180677ddbec98d6257502 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:05:35 +0100 Subject: [PATCH 05/17] fix: add basePath support for subfolder hosting --- src/pages/index-page/index.hbs | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/pages/index-page/index.hbs b/src/pages/index-page/index.hbs index 0b14ee3..2f701ea 100644 --- a/src/pages/index-page/index.hbs +++ b/src/pages/index-page/index.hbs @@ -161,19 +161,19 @@
- roboclub + roboclub
- pbc + pbc
- 200x300 + 200x300
@@ -181,7 +181,7 @@ advection @@ -191,7 +191,7 @@ bandapixels @@ -199,13 +199,13 @@
- canva + canva
- codeclub + codeclub
@@ -213,7 +213,7 @@ cyberpolice @@ -223,7 +223,7 @@ dynamic_streaming @@ -233,7 +233,7 @@ grammarly @@ -243,7 +243,7 @@ htmlacademy @@ -251,7 +251,7 @@
- italent + italent
@@ -259,7 +259,7 @@ jetbrains @@ -267,13 +267,13 @@
- notion + notion
- onix + onix
@@ -281,7 +281,7 @@ ring_labs @@ -289,19 +289,19 @@
- slack + slack
- techsoup + techsoup
- wowza + wowza
From 56b9e0aab0771f974461cfc0b1a159c28047b0cb Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:05:36 +0100 Subject: [PATCH 06/17] fix: add basePath support for subfolder hosting --- src/pages/contacts-page/index.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/contacts-page/index.hbs b/src/pages/contacts-page/index.hbs index 9491d84..77a64ad 100644 --- a/src/pages/contacts-page/index.hbs +++ b/src/pages/contacts-page/index.hbs @@ -9,8 +9,8 @@
- - + +
From 8d27e8c7352368e9fbb137f0f76497a8aec90ae4 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:05:37 +0100 Subject: [PATCH 07/17] fix: add basePath support for subfolder hosting --- src/pages/about-us-page/index.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/about-us-page/index.hbs b/src/pages/about-us-page/index.hbs index fde59b0..36aa517 100644 --- a/src/pages/about-us-page/index.hbs +++ b/src/pages/about-us-page/index.hbs @@ -54,7 +54,7 @@
{{#each htmlWebpackPlugin.options.content.translations.about.history.events}}
- {{ this.description }} + {{ this.description }}
{{ this.date }}
{{ this.description }}
@@ -101,7 +101,7 @@
{{ htmlWebpackPlugin.options.content.translations.philosophy }}
From df83d949a4ddc930b036ae528956ff67cea44df6 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:14 +0100 Subject: [PATCH 08/17] fix: relative paths for subfolder hosting support --- webpack.config.js | 49 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 94d4e3d..7431b12 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -311,7 +311,24 @@ const mediaMentionsConfig = [ }, ]; const BASE_URL = 'https://programming.org.ua'; -const BASE_PATH = process.env.BASE_PATH || ''; +const fixPaths = (obj, baseHref) => { + if (typeof obj === 'string') { + return obj + .replace(/href='\/([^']+)'/g, `href='${baseHref}$1'`) + .replace(/href="\/([^"]+)"/g, `href="${baseHref}$1"`); + } else if (Array.isArray(obj)) { + return obj.map((o) => fixPaths(o, baseHref)); + } else if (obj && typeof obj === 'object') { + return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, fixPaths(v, baseHref)])); + } + return obj; +}; + +const getBaseHref = (filenamePrefix, relativePagePath) => { + const fullPath = (filenamePrefix + relativePagePath).replace(/^\//, '').replace(/\/$/, ''); + const depth = fullPath ? fullPath.split('/').length : 0; + return depth === 0 ? './' : '../'.repeat(depth); +}; module.exports = async (_, { mode = 'development' }) => ({ entry: { @@ -395,20 +412,24 @@ module.exports = async (_, { mode = 'development' }) => ({ .filter((l) => l !== lang) .map((l) => localesConfig[l]); - const getCommonContent = (relativePagePath) => ({ - lang, - translations, - locale, - langPrefix, - basePath: BASE_PATH, - relativePagePath, - canonicalUrl: `${BASE_URL}${filenamePrefix}${relativePagePath}`, - alternativeLocales: alternativeLocales.map(({ langPrefix, lang }) => ({ + const getCommonContent = (relativePagePath) => { + const baseHref = getBaseHref(filenamePrefix, relativePagePath); + return { lang, - url: `${BASE_URL}${langPrefix}${relativePagePath}`, - })), - currentYear: new Date().getFullYear(), - }); + translations: fixPaths(translations, baseHref), + locale, + langPrefix, + baseHref, + langPrefixPath: langPrefix ? langPrefix.replace(/^\//, '') + '/' : '', + relativePagePath, + canonicalUrl: `${BASE_URL}${filenamePrefix}${relativePagePath}`, + alternativeLocales: alternativeLocales.map(({ langPrefix, lang }) => ({ + lang, + url: `${BASE_URL}${langPrefix}${relativePagePath}`, + })), + currentYear: new Date().getFullYear(), + }; + }; return [ ...htmlWebpackPlugins, From 8bb14a8d89f7c29550e14a591d4397370b920cd4 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:15 +0100 Subject: [PATCH 09/17] fix: relative paths for subfolder hosting support --- src/template-partials/meta.hbs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/template-partials/meta.hbs b/src/template-partials/meta.hbs index ca949f1..228cdec 100644 --- a/src/template-partials/meta.hbs +++ b/src/template-partials/meta.hbs @@ -16,10 +16,10 @@ - - - - + + + + {{ pageTranslations.meta.title }} {{#each htmlWebpackPlugin.options.content.alternativeLocales}} From fa65c29861033e614528804294f23caabe0da86c Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:16 +0100 Subject: [PATCH 10/17] fix: relative paths for subfolder hosting support --- src/header/header.hbs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/header/header.hbs b/src/header/header.hbs index f934bb3..308072b 100644 --- a/src/header/header.hbs +++ b/src/header/header.hbs @@ -18,7 +18,7 @@ {{/isEqual}}
- +
From 7a6788163743aa017fa34c45e227e81ad8d2b800 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:17 +0100 Subject: [PATCH 11/17] fix: relative paths for subfolder hosting support --- src/footer/footer.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/footer/footer.hbs b/src/footer/footer.hbs index 65a5e3b..ea77ca7 100644 --- a/src/footer/footer.hbs +++ b/src/footer/footer.hbs @@ -62,7 +62,7 @@ {{ htmlWebpackPlugin.options.content.translations.support_us_button }} From 221ab385b82ff48c5e953eb4c14af69c33bdb2cc Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:18 +0100 Subject: [PATCH 12/17] fix: relative paths for subfolder hosting support --- src/pages/index-page/index.hbs | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/pages/index-page/index.hbs b/src/pages/index-page/index.hbs index 2f701ea..a9f479b 100644 --- a/src/pages/index-page/index.hbs +++ b/src/pages/index-page/index.hbs @@ -29,7 +29,7 @@