-
+
+
{{#each htmlWebpackPlugin.options.content.translations.about.history.events}}
-
+
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}}
+
{{ this.date }}
{{ this.description }}
@@ -101,7 +101,7 @@
- Ш++
+ Ш++
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 @@
{{ htmlWebpackPlugin.options.content.translations.home.intro.courses.teens.title }}
@@ -123,12 +123,12 @@
{{ htmlWebpackPlugin.options.content.translations.home.intro.courses.adults.title }} @@ -44,7 +44,7 @@
{{ htmlWebpackPlugin.options.content.translations.home.intro.courses.teens.title }}
@@ -123,12 +123,12 @@
{{ htmlWebpackPlugin.options.content.translations.feedback_button }}
{{ htmlWebpackPlugin.options.content.translations.adults.feedbacks.see_all }}
@@ -161,19 +161,19 @@
@@ -181,7 +181,7 @@
@@ -191,7 +191,7 @@
@@ -199,13 +199,13 @@
@@ -213,7 +213,7 @@
@@ -223,7 +223,7 @@
@@ -233,7 +233,7 @@
@@ -243,7 +243,7 @@
@@ -251,7 +251,7 @@
@@ -259,7 +259,7 @@
@@ -267,13 +267,13 @@
@@ -281,7 +281,7 @@
@@ -289,19 +289,19 @@
From 6ccd49767df2eeb8b7d51cc25fc6c04807a240db Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:19 +0100
Subject: [PATCH 13/17] fix: relative paths for subfolder hosting support
---
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 77a64ad..5771788 100644
--- a/src/pages/contacts-page/index.hbs
+++ b/src/pages/contacts-page/index.hbs
@@ -9,8 +9,8 @@
-
-
+
+
From 0ee93c5bac7fee823cbbd14a951ffc0a35d917cd Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:20 +0100
Subject: [PATCH 14/17] fix: relative paths for subfolder hosting support
---
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 36aa517..c05073d 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.date }}
{{ this.description }}
@@ -101,7 +101,7 @@
From 544c9c2e910ee97abd84c1a91daad729c9d55409 Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:21 +0100
Subject: [PATCH 15/17] fix: relative paths for subfolder hosting support
---
src/pages/courses-page/index.hbs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/courses-page/index.hbs b/src/pages/courses-page/index.hbs
index 0c0e7da..93a989c 100644
--- a/src/pages/courses-page/index.hbs
+++ b/src/pages/courses-page/index.hbs
@@ -16,7 +16,7 @@
{{{ this }}}
{{/each}}
{{ htmlWebpackPlugin.options.content.translations.anketa }}
From 236893d8b5f0793ee15d8e278344c1c7bc52a3f3 Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:22 +0100
Subject: [PATCH 16/17] fix: relative paths for subfolder hosting support
---
src/pages/feedbacks-page/index.hbs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/feedbacks-page/index.hbs b/src/pages/feedbacks-page/index.hbs
index 892fbe3..e45cb57 100644
--- a/src/pages/feedbacks-page/index.hbs
+++ b/src/pages/feedbacks-page/index.hbs
@@ -15,7 +15,7 @@
{{ htmlWebpackPlugin.options.content.translations.feedback_button }}
From a7e0b0b4fed640c6fd41428488e1aeb2b2685a2d Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:23 +0100
Subject: [PATCH 17/17] fix: relative paths for subfolder hosting support
---
utils/handlebars-helpers/headerMenuLink.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/utils/handlebars-helpers/headerMenuLink.js b/utils/handlebars-helpers/headerMenuLink.js
index e3ce161..5250196 100644
--- a/utils/handlebars-helpers/headerMenuLink.js
+++ b/utils/handlebars-helpers/headerMenuLink.js
@@ -3,12 +3,13 @@ const Handlebars = require('handlebars/runtime');
module.exports = function (
textTranslationKey,
url,
- { langPrefix, relativePagePath, translations }
+ { langPrefix, langPrefixPath, baseHref, relativePagePath, translations }
) {
const isActive = relativePagePath.replace(/\/$/, '') === url.replace(/#.+/, '');
const text = textTranslationKey.split('.').reduce((acc, val) => acc[val], translations);
+ const relativeUrl = url.replace(/^\//, '');
return new Handlebars.SafeString(
- `${text} `
+ `${text} `
);
};
@@ -181,7 +181,7 @@
@@ -191,7 +191,7 @@
@@ -199,13 +199,13 @@
@@ -213,7 +213,7 @@
@@ -223,7 +223,7 @@
@@ -233,7 +233,7 @@
@@ -243,7 +243,7 @@
@@ -251,7 +251,7 @@
@@ -259,7 +259,7 @@
@@ -267,13 +267,13 @@
@@ -281,7 +281,7 @@
@@ -289,19 +289,19 @@
From 6ccd49767df2eeb8b7d51cc25fc6c04807a240db Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:19 +0100
Subject: [PATCH 13/17] fix: relative paths for subfolder hosting support
---
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 77a64ad..5771788 100644
--- a/src/pages/contacts-page/index.hbs
+++ b/src/pages/contacts-page/index.hbs
@@ -9,8 +9,8 @@
@@ -191,7 +191,7 @@
@@ -223,7 +223,7 @@
@@ -233,7 +233,7 @@
@@ -243,7 +243,7 @@
@@ -251,7 +251,7 @@
@@ -259,7 +259,7 @@
@@ -289,19 +289,19 @@
-
+
+
{{#each htmlWebpackPlugin.options.content.translations.about.history.events}}
-
+
From 544c9c2e910ee97abd84c1a91daad729c9d55409 Mon Sep 17 00:00:00 2001
From: roman-shpp <55261254+roman-shpp@users.noreply.github.com>
Date: Wed, 1 Apr 2026 17:29:21 +0100
Subject: [PATCH 15/17] fix: relative paths for subfolder hosting support
---
src/pages/courses-page/index.hbs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/courses-page/index.hbs b/src/pages/courses-page/index.hbs
index 0c0e7da..93a989c 100644
--- a/src/pages/courses-page/index.hbs
+++ b/src/pages/courses-page/index.hbs
@@ -16,7 +16,7 @@
${text} `
+ `${text} `
);
};
+
{{ this.date }}
{{ this.description }}
@@ -101,7 +101,7 @@
{{{ this }}}
{{/each}} {{ htmlWebpackPlugin.options.content.translations.anketa }} From 236893d8b5f0793ee15d8e278344c1c7bc52a3f3 Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:22 +0100 Subject: [PATCH 16/17] fix: relative paths for subfolder hosting support --- src/pages/feedbacks-page/index.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/feedbacks-page/index.hbs b/src/pages/feedbacks-page/index.hbs index 892fbe3..e45cb57 100644 --- a/src/pages/feedbacks-page/index.hbs +++ b/src/pages/feedbacks-page/index.hbs @@ -15,7 +15,7 @@ {{ htmlWebpackPlugin.options.content.translations.feedback_button }} From a7e0b0b4fed640c6fd41428488e1aeb2b2685a2d Mon Sep 17 00:00:00 2001 From: roman-shpp <55261254+roman-shpp@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:29:23 +0100 Subject: [PATCH 17/17] fix: relative paths for subfolder hosting support --- utils/handlebars-helpers/headerMenuLink.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/handlebars-helpers/headerMenuLink.js b/utils/handlebars-helpers/headerMenuLink.js index e3ce161..5250196 100644 --- a/utils/handlebars-helpers/headerMenuLink.js +++ b/utils/handlebars-helpers/headerMenuLink.js @@ -3,12 +3,13 @@ const Handlebars = require('handlebars/runtime'); module.exports = function ( textTranslationKey, url, - { langPrefix, relativePagePath, translations } + { langPrefix, langPrefixPath, baseHref, relativePagePath, translations } ) { const isActive = relativePagePath.replace(/\/$/, '') === url.replace(/#.+/, ''); const text = textTranslationKey.split('.').reduce((acc, val) => acc[val], translations); + const relativeUrl = url.replace(/^\//, ''); return new Handlebars.SafeString( - `
+
+
+
+
+
+
+
+
+
+
+