@videinfra/static-website-builder 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [2.4.2] - 2026-04-23
8
+ ### Added
9
+ - Multilingual sitemap generation
10
+
7
11
  ## [2.4.1] - 2026-04-23
8
12
  ### Added
9
13
  - Allow to specify additional static data for env variables in task config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videinfra/static-website-builder",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Customizable static site project builder",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -23,9 +23,14 @@ export const sitemap = {
23
23
  },
24
24
 
25
25
  // Remove file extension from the URL
26
- getLoc: function(siteUrl, loc, entry) {
26
+ getLoc: function (siteUrl, loc, entry) {
27
27
  return loc.replace(/\.\w+$/, '');
28
28
  },
29
+
30
+ // Remove lastmod, we don't know that
31
+ lastmod: function () {
32
+ return null;
33
+ },
29
34
  },
30
35
 
31
36
  // Production only settings, overwrites default settings
@@ -1,4 +1,5 @@
1
1
  import getEnvData from '../env/get-env.js';
2
+ import { getTaskConfig } from './../../lib/get-config.js';
2
3
 
3
4
  /**
4
5
  * Modify configuration
@@ -14,5 +15,36 @@ export default function preprocessSitemapConfig (config = {}, fullConfig) {
14
15
  config.sitemap = config.sitemap || {};
15
16
  config.sitemap.siteUrl = envData.env.host;
16
17
 
18
+ // Languages
19
+ const translationConfig = getTaskConfig('translations');
20
+ const locales = translationConfig.locales;
21
+ const defaultLocale = translationConfig.defaultLocale;
22
+
23
+ if (locales.length > 1) {
24
+ // Add all other locales to ignore list
25
+ config.ignore = config.ignore || [];
26
+ config.ignore = config.ignore.concat(locales.map(function(locale) {
27
+ return locale + '/**';
28
+ }));
29
+
30
+ // Set hreflang
31
+ config.sitemap.hreflang = locales.map(function(locale) {
32
+ return {
33
+ lang: locale,
34
+ getHref: function(siteUrl, file, locale) {
35
+ let url;
36
+
37
+ if (locale !== defaultLocale) {
38
+ url = siteUrl + '/' + locale + '/' + file;
39
+ } else {
40
+ url = siteUrl + '/' + file;
41
+ }
42
+
43
+ return url.replace(/\/{2,}/g, '/').replace(/\/$/, '');
44
+ }
45
+ };
46
+ });
47
+ }
48
+
17
49
  return config;
18
50
  }
@@ -50,8 +50,8 @@ module.exports = function (options = {}) {
50
50
  return callback(new PluginError(pluginName), msg);
51
51
  }
52
52
 
53
- //skip 404 file
54
- if (/404\.html?$/i.test(file.relative)) {
53
+ // skip 404 and 500 files
54
+ if (/(404|500)\.html?$/i.test(file.relative)) {
55
55
  return callback();
56
56
  }
57
57