hexo-theme-linen 1.0.39 → 1.0.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-linen",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "A clean Hexo theme",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/lynanbreeze/hexo-theme-linen",
@@ -86,13 +86,23 @@ hexo.extend.helper.register("getTranslationPage", function () {
86
86
  : false;
87
87
  let origin =
88
88
  config?.theme_config?.siteOriginLocaleMap?.[targetLanguage] || config.url;
89
- let targetLanguagePath = `${origin}${this.url_for(page.path)}`;
89
+ // `url_for` includes the current site's `root` (for example, the GitHub
90
+ // Pages repository path). The locale origin may already include its own
91
+ // root, so only append the page path portion to avoid duplicating it.
92
+ const rootPath = String(config.root || "/").replace(/^\/+|\/+$/g, "");
93
+ const siteRoot = rootPath ? `/${rootPath}/` : "/";
94
+ let pagePath = this.url_for(page.path);
95
+ if (siteRoot !== "/" && pagePath.startsWith(siteRoot)) {
96
+ pagePath = pagePath.slice(siteRoot.length - 1);
97
+ }
98
+ const originBase = String(origin || "").replace(/\/+$/, "");
99
+ let targetLanguagePath = `${originBase}/${String(pagePath).replace(/^\/+/, "")}`;
90
100
  if (page?.seriesInfo?.mappingName) {
91
- targetLanguagePath = `${origin}/series/${page?.seriesInfo?.mappingName}/`;
101
+ targetLanguagePath = `${originBase}/series/${page?.seriesInfo?.mappingName}/`;
92
102
  }
93
103
  if (this.is_category()) {
94
104
  if (categoriesInfo?.[page.category]?.mappingName) {
95
- targetLanguagePath = `${origin}/categories/${
105
+ targetLanguagePath = `${originBase}/categories/${
96
106
  categoriesInfo?.[page.category]?.mappingName
97
107
  }/`;
98
108
  } else {
@@ -101,7 +111,7 @@ hexo.extend.helper.register("getTranslationPage", function () {
101
111
  }
102
112
  if (this.is_tag()) {
103
113
  if (tagsInfo?.[page.tag]?.mappingName) {
104
- targetLanguagePath = `${origin}/tags/${tagsInfo?.[page.tag]?.mappingName}/`;
114
+ targetLanguagePath = `${originBase}/tags/${tagsInfo?.[page.tag]?.mappingName}/`;
105
115
  } else {
106
116
  hasTranslatation = false;
107
117
  }
@@ -1113,6 +1113,7 @@ body {
1113
1113
  display: none;
1114
1114
  }
1115
1115
  figure.highlight {
1116
+ margin-bottom: 0;
1116
1117
  pre {
1117
1118
  white-space: pre-wrap;
1118
1119
  word-wrap: break-word;