Things to do when updating Bludit
Photo by Markus Spiske: https://www.pexels.com/photo/green-and-yellow-printed-textile-330771/
I finally got around to update to the recent version of Bludit. And as I made two changes to files which will be overwritten, I made myself a small documentation.
Changing the default link target
Post with code example, here: https://admin.brennt.net/changing-the-default-link-target-in-bludits-tinymce
- Open file
bludit-folder/bl-plugins/tinymce/plugin.php
file - Search for
tinymce.init
- Then we add the
default_link_target: '_blank'
parameter at the end of the list - Don't forget to add a semicolon behind the formerly last parameter
Keep the syntax highlighting
Original post: https://admin.brennt.net/bludit-and-syntax-highlighting
- Open:
bludit-folder/bl-plugins/tinymce/tinymce/plugins/codesample/plugin.min.js
- Search for
<pre
and in the class property add line-numbers. It should now look like this:t.insertContent('<pre id="__new" class="language-'+a+' line-numbers">'+r+"</pre>")
A little after that pre you will also find
t.dom.setAttrib(e,"class","language-"+a)
, add the line-numbers class in there too, it should look like this:t.dom.setAttrib(e,"class","line-numbers language-"+a)
- Edit a random blogpost with code in it to verify that newly rendered pages get the line-numbers and syntax highlighting.
Enhancing Cookie security
Mozillas Observatory states that the Bludit Session Cookie is missing the samesite attribute and the Cookie name isn't prefixed with __Secure-
or __Host-
. I opened an issue for this on GitHub (Bludit issue #1582 Enhance cookie security by setting samesite attribute and adding __Secure- prefix to sessionname) but until this is integrated we can fix it in the following way:
- Open
bludit-folder/bl-kernel/helpers/session.class.php
- Comment out the line containing:
private static $sessionName = 'BLUDIT-KEY';
- Copy & paste the following to change the Cookie name:
-
// Set the __Secure- prefix if site is called via HTTPS, preventing overwrites from insecure origins // see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie_prefixes //private static $sessionName = 'BLUDIT-KEY'; private static $sessionName = '__Secure-BLUDIT-KEY';
-
- Search for the function
session_set_cookie_params
- Add the following line to add the samesite attribute to the Cookie by adding the following line. Also add a comma at the end of the formerly last line.
'samesite' => 'strict'
- it should looks like this:
-
session_set_cookie_params([ 'lifetime' => $cookieParams["lifetime"], 'path' => $path, 'domain' => $cookieParams["domain"], 'secure' => $secure, 'httponly' => true, 'samesite' => 'strict' ]);
-
Check is the RSS-Feed works
- Access https://admin.brennt.net/rss.xml and verify there is content displayed.
- If not: Check if the RSS-Plugin works and is activated
Apply / check CSS changes
I made some small changes to the Solen Theme CSS. These must be re-done when the theme is updated.
- Open
bl-themes/solen-1.0/css/style.css
- Change link color:
- Element:
.plugin a, ul li a, .footer_entry a, .judul_artikel a
, line 5 - Change:
color: #DE004A;
- To:
color: #F06525;
- Element:
- Change link color when hovering:
- Element:
.plugin a:hover, ul li a:hover, .footer_entry a:hover, .judul_artikel a:hover
, line 10 - Change:
color: #F06525;
- To:
color: #C68449;
- Element:
- Fix position of the blockquote bar:
- Element:
blockquote::box-shadow
, line 24 - Change:
box-shadow: inset 5px 0 rgb(255, 165, 0);
- To:
box-shadow: -5px 0px 0px 0px rgb(255, 165, 0);
- Element:
- Format code in posts:
- Add the following element after line 37:
-
/* My custom stuff */ code { font-size: 87.5%; color: #e83e8c; word-wrap: break-word; font-family: 'Roboto Mono', monospace; }
- Same padding-bottom as padding-top for header:
- Element
.section_title
, line 136 - Change:
padding-bottom: 0px;
- To:
padding-bottom: 0.6em;
- Element
- Disable the white blur for the introduction texts:
- Element:
.pratinjau_artikel p:after
, line 277 - Change
background: linear-gradient(to right, transparent, #ffffff 80%);
- To:
background: 0% 0%;
- Element:
Solen-Theme changes
- Make header smaller:
- Open
solen-1.2/php/mini-hero.php
- Remove line 4:
<h2 class="hero_welcome"><?php echo $L->get('welcome'); ?></h2>
- Open