[Solved]: Custom HTML Head Content not working #2598

Closed
opened 2026-02-05 04:35:23 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @SimpelMe on GitHub (Jan 22, 2022).

Describe the Bug

Any style code written into "Custom HTML Head Content" I tested is not executed.
Second I couldn't find this style in <head> except:

<style id="custom-styles" data-color="#555555" data-color-light="rgba(85,85,85,0.15)">
    :root {
        --color-primary: #555555;
        --color-primary-light: rgba(85,85,85,0.15);
        --color-bookshelf: #555555;
        --color-book: #555555;
        --color-chapter: #808080;
        --color-page: #808080;
        --color-page-draft: #808080;
    }
</style>

Steps to Reproduce

  1. go to /settings#customization
  2. write css into section "Custom HTML Head Content" like:
<style>
// underline all links in article
.card a, a.postlink {
  text-decoration: underline !important;
}
</style>
  1. save and watch an article with a link inside

Expected Behaviour

Link should be underlined.
That style should be written to <head>.

Screenshots or Additional Context

I'm not totally sure but I think I introduced that style in v21.12.1 or v21.12 to my wiki and it worked.

Exact BookStack Version

v21.12.2

PHP Version

7.4.25 cli

Hosting Environment

  • 5.10.27-gentoo
  • no proxy
Originally created by @SimpelMe on GitHub (Jan 22, 2022). ### Describe the Bug Any style code written into "Custom HTML Head Content" I tested is not executed. Second I couldn't find this style in \<head\> except: ```css <style id="custom-styles" data-color="#555555" data-color-light="rgba(85,85,85,0.15)"> :root { --color-primary: #555555; --color-primary-light: rgba(85,85,85,0.15); --color-bookshelf: #555555; --color-book: #555555; --color-chapter: #808080; --color-page: #808080; --color-page-draft: #808080; } </style> ``` ### Steps to Reproduce 1. go to /settings#customization 2. write css into section "Custom HTML Head Content" like: ```css <style> // underline all links in article .card a, a.postlink { text-decoration: underline !important; } </style> ``` 3. save and watch an article with a link inside ### Expected Behaviour Link should be underlined. That style should be written to \<head\>. ### Screenshots or Additional Context I'm not totally sure but I think I introduced that style in v21.12.1 or v21.12 to my wiki and it worked. ### Exact BookStack Version v21.12.2 ### PHP Version 7.4.25 cli ### Hosting Environment - 5.10.27-gentoo - no proxy
OVERLORD added the 🐛 Bug label 2026-02-05 04:35:23 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 22, 2022):

Hi @SimpelMe,

You custom style is not working due to invalid syntax. The // style of comments is not valid for CSS, Remove those and it should work:

<style>
.card a, a.postlink {
  text-decoration: underline !important;
}
</style>
@ssddanbrown commented on GitHub (Jan 22, 2022): Hi @SimpelMe, You custom style is not working due to invalid syntax. The `//` style of comments is not valid for CSS, Remove those and it should work: ```html <style> .card a, a.postlink { text-decoration: underline !important; } </style> ```
Author
Owner

@SimpelMe commented on GitHub (Jan 22, 2022):

Uh, you're totally right. Changed between to many script languages these days.

Thanks for answering and I close.

@SimpelMe commented on GitHub (Jan 22, 2022): Uh, you're totally right. Changed between to many script languages these days. Thanks for answering and I close.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2598