diff options
author | jianse <jianse@users.noreply.github.com> | 2021-01-04 18:46:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 18:46:18 +0300 |
commit | 28bcb78fd9f396204930ae288e0581f00fa42705 (patch) | |
tree | e026e8d4231f21c065c3ebbc5a98b66c89ca00e7 | |
parent | ff744203ea3287b3e317bb0b439ee8bb529aa038 (diff) |
fix: wrong glyph-correction URL when baseURL is set to sub-directory (#291)
fixes #287
* style: ajust code style and trim last "/" character of baseRelURL
...to avoid generating wrong URL "//fonts/..." when baseURL is set to
site's root directory.
Co-authored-by: reuixiy <reuixiy@gmail.com>
-rw-r--r-- | assets/scss/base/_glyph-correction.scss | 8 | ||||
-rw-r--r-- | assets/scss/main.scss | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/assets/scss/base/_glyph-correction.scss b/assets/scss/base/_glyph-correction.scss index 5238fd1..9c3cbac 100644 --- a/assets/scss/base/_glyph-correction.scss +++ b/assets/scss/base/_glyph-correction.scss @@ -1,10 +1,10 @@ @font-face { font-family: 'glyph-correction'; font-display: swap; - src: url('/fonts/glyph-correction.woff2') format('woff2'), - url('/fonts/glyph-correction.woff') format('woff'), - url('/fonts/glyph-correction.ttf') format('truetype'), - url('/fonts/glyph-correction.eot') format('embedded-opentype'); + src: url('#{$baseRelURL}/fonts/glyph-correction.woff2') format('woff2'), + url('#{$baseRelURL}/fonts/glyph-correction.woff') format('woff'), + url('#{$baseRelURL}/fonts/glyph-correction.ttf') format('truetype'), + url('#{$baseRelURL}/fonts/glyph-correction.eot') format('embedded-opentype'); unicode-range: U+00B7, U+2014, U+2022, U+2026; font-weight: inherit; font-style: inherit; diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 88da5df..e9fbb5a 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -128,6 +128,8 @@ // Chinese Punctuation Glyph Correction {{ if .Site.Params.enableChinesePunctuationGlyphCorrection }} + $baseRelURL: "{{ strings.TrimSuffix (.Site.BaseURL | relURL) "/" }}"; + @import "base/glyph-correction"; // Magic adjustment for zh-cn |