Joomla 4 – Cassiopeia Template – a bunch of Tips & Tricks
In this article, Marc Dechèvre will present a collection of tips and tricks related to the Joomla 4 default frontend template: Cassiopeia.
0. Preamble
0.1. Too lazy to read? Watch (most of) this article in video
This article is an improved version of what was presented live at the Joomla User Group New Jersey on 20 January 2022.
Feel free to watch the video.
0.2. Don't forget: the template media folders have just moved with J!4.1
As you might know, with the introduction of Child Templates in J4.1 the path to the “template media folders” (css
, images
, js
and scss
) changes
- from
templates/cassiopeia/
in J!4.0 - to
media/templates/site/cassiopeia/
in J!4.1+
for Cassiopeia (and similarly for all Templates which are / will be compatible with Child Templates).
Good to know: if you created for example a templates/cassiopeia/css/user.css
in J4.0, once you update to 4.1 the file will be automagically moved to media/templates/site/cassiopeia/css/user.css
.
So you don’t have to worry about this, Joomla (Dimitris Grammatikogiannis in the present case) got you covered ?
1. Resources
“Standing on the shoulders of giants”
The goal of this session is to try and give tips & tricks about Cassiopeia which are not already out there.
But what if it is out there and you missed it?
I always like to gather all the available sources about a topic, be it Custom Fields… or Cassiopeia ?
So here is all I am aware of (and please get back to me if I have forgotten some):
- Customize your Cassiopeia Template by Elisa Foltyn (aka coolcat) at Joomla User Group New Jersey – Nov 2021
- Child Templates in J!4.1 by Dimitris Grammatikogiannis (aka dgrammatiko) at Joomla User Group London – Dec 2021
- Joomla 4.1 insights by Dimitris Grammatikogiannis (aka dgrammatiko) at Joomla Extensions Developers JUG on 2022.01.20
- A tutorial on how to use the Cassiopeia template for Joomla 4 by Astrid Günther on her blog
- Joomla 4: Tweak Cassiopeia with a top banner and horizontal navigation by Astrid Günther in the Joomla Community Magazine – Sep 2021
- More information about the available Classes for the Blog View (image-left, image-right, image-bottom, image-alternate, boxed, …) by Ciaran Walsh
- How to build accessible websites using Cassiopeia by Christiane Maier-Stadtherr on 2021.09.21 at JUG London
- Joomla 4: Cassiopeia Template by Patrick Jackson in the Joomla Community Magazine – Jan 2021
- Kickstart Cassiopeia, the new Joomla frontend template Module by Maarten Blokdijk at JoomlaDay USA 2021
- Cassiopeia – Templates in Joomla 4 [in German] by Viviana Menzel at JoomlaDay DACH 2021 – Sep 2021
- Presentation https://www.dr-menzel-it.de/images/J4-Template.pdf
- Video https://www.youtube.com/watch?v=wk19Asepo8c
- Demo site with explanations https://cassiopeia.joomla.com/
- Cassiopeia Template in Joomla 4 [in German] by Hagen Graf – Oct 2021
- How to Use the Menu with Cassiopeia in Joomla 4 by LT Digital Team | Dec 9, 2021
2. Reasons to love Cassiopeia
There are many good reasons to stick to the native template Cassiopeia
- it is Accessible (AFAIK it not the case for the classical templates/frameworks out there)
- it is by design super performant (I was surprised to get 97% on a Lighthouse/GTMetrix for a real website even before doing the most basic optimisation like enabling gzip)
- it uses the latest techniques (CSS Grid, CSS Variables, vanilla javascript instead of frameworks, …)
and latest tools (Bootstrap5, Font Awesome 5, …) - new features are regularly added, like the ones coming along with J4.1 (note: J4.1 RC was released on 18 January 2022: https://github.com/joomla/joomla-cms/releases )
- Child Templates
- Icons for Menu Items
Of course, you might also have you own (good) reasons to use another template/framework.
But Cassiopeia is clearly an excellent option for Joomla 4 (while for Joomla 3 I have never considered using Protostar to build a website except for testing purposes)
3. First impression of Cassiopeia
The first time I saw the Cassiopeia Template Options I thought “oh nooo, so few Options”.
But actually -as we see in this presentation and in the other resources mentioned- we can easily compensate for that.
At the end of the day, it is even a good thing to have a default Template that is not bloated because it means
- better performance
- more stability
- and even more creativity & flexibility since we can use/(re)discover Joomla core features to customize it according to our individual needs
4. Tips & tricks around Cassiopeia
4.1. Overriding the Favicon
Cassiopeia’s default favicons path can be found in the <head>
If you want to override them, all you need to do is to create an override of these icons, for example
/templates/cassiopeia/images/joomla-favicon.svg
for J!4.0/media/templates/site/cassiopeia/images/joomla-favicon.svg
from J!4.1 onwards
Note: converting online an image to svg/ico is easy, just Google it
4.2. Fonts
4.2.1. Add Google Fonts to your template
- Go to https://fonts.google.com/
- Pick the font of your choice
- Simply adapt and add the following CSS to
/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0):
Source: https://coolcat-creations.com/en/blog/customize-your-cassiopeia-template
Note: this method should be the last choice, it hurts too much the performance. See the next options
4.2.2. Add Google Fonts locally to your template
Because of Privacy laws (like GDPR in Europe), you might not be allowed to call a distant font (because it allows the provider to track your visitors).
No problem! You can easily download the necessary files and add the corresponding CSS to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
See https://google-webfonts-helper.herokuapp.com/fonts
Source: https://blog.astrid-guenther.de/en/cassiopeia-optionen/ > Fonts Scheme
4.2.3. Add any Font to your template txs to Child Template
Note: this requires J4.1+ since it makes use of the new feature called Child Template. Txs @dgrammatiko for the feature & the tip!
- Create a child and make it the default
- Edit the templateDetails.xml of the child and add one more line (basically change the font names of an existing option) in the useFontScheme field
- that’s all
See the screenshots:
4.3. Colors
4.3.1. Changing the color set on the whole site
Add the following CSS to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
Adapt the colors of course, this is just an example…
4.3.2. Changing the color set on a given page
- Go to Menu > [ your menu ]
- Click on the chosen Menu Item
- Select the Page Display tab
- In the Page Class option add for instance
colors1
- Add the following CSS to
/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0)
Basic example:
More advanced example allowing to play with transparency (RGBA) because my initial variable is not directly expressed as a color, but as the RGB value (example: 37, 143, 167
):
4.3.3. Add new color scheme in Cassiopeia
Note: requires Joomla 4.1+
The default Joomla front-end template Cassiopeia ships with two color schemes: standard and alternative.
If you modify a color scheme your modification can get lost at some next update. In Joomla 4.1 you now have the possiblity to add additional color schemes:
Create your own css file on the media\site\templates\cassiopeia\css\global
folder with a name like custom_colors_orange.css
and you can then select it in the Cassiopeia template.
For more information see https://issues.joomla.org/tracker/joomla-cms/35917
4.3.4. Dark Mode
There are many good reasons to have Dark Mode on your website.
Thanks to the free plugin Dark Magic by Nicholas Dionysopoulos you can very easily enable and customize Dark Mode
- on the back-end (only with the default Atum Template)
- on the front-end (only with the default Cassiopeia Template)
Note: at the moment the README.md on https://github.com/nikosdion/DarkMagic only mentions Joomla 3. But actually the plugin has two versions, one for J3 and one for J4. Simply click on Releases on the right column
- v2.x is DarkMagic for Joomla 4
- v1.x is DarkMagic for Joomla 3
Of course, especially for the front-end, you will probably want to customize further some colors. Good news: Cassiopeia makes an extensive use of what is commonly called “CSS Variables” (the real name is “Custom Properties”), which makes it easy to customize ao colors: they are defined once and are then used at 100+ different places.
Here is an example CSS I added to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0) in order to customize further the front-end colors in Dark Mode (to have the header, the buttons, the links etc with the official colors of the site):
4.4. Layout
4.4.1. Know all possible Positions in Cassiopeia
The most complete/accurate presentation of all available positions I have found so far is the following. Txs to its author, Pedro Olaia, for sharing it.
Note: the html element and classes at the “MENU” position change according to the module inside. So if the module is actually the menu module, it will be: <nav class="navbar ...">
and not <div class="moduletable module">
. So some html elements and classes might change acording to the module, options selected and viewport size
4.4.2. How to have the Logo on the same row as the Menu
In System > Template Styles > Cassiopeia > Advanced tab > Brand option, if set to Yes you can either
- select a Logo
- or type a Title (with or without a Tagline)
This works of course but given the Layout of Cassiopeia, this Logo or Title are on a separate row before the Header row typically containing the Menu.
OK, why not. There is probably a reason for that that I ignore but it is clearly not the practice on 99,9% of the websites.
So if you want your Logo on the same row as the Menu, you can simply proceed as follows:
- Go to Content > Site Modules
- Click on New
- Select a module of type Custom (HTML)
- There insert simply your Logo (and if you wish add a hyperlink to the homepage, namely
"/"
) - Select the Position
Menu
- Assign the Module to All Pages (unless you have for example a different logo according to the Language)
- Save
4.4.3. Having a nice customized Footer
Create the appropriate new Module
- Go to Content > Site Modules or go to System > Manage > Site Modules (yes, 2 ways to get there ?)
- Click on the New Button
- Select the Module of Type Footer (“This module shows the Joomla! copyright information.”)
- Give a Title
- Select Position
Footer
- If necessary go to the Menu Assignment tab and customize
- Save
See the result on the front-end
- two lines of text appear in the footer of the site. The nice thing is that the Year and the Site Name are created dynamically
- the displayed text is determined by the native Language Strings of Joomla, namely
- MOD_FOOTER_LINE1
Copyright © %date% %sitename%. All Rights Reserved.
- MOD_FOOTER_LINE2
<a href="https://www.joomla.org">Joomla!</a> is Free Software released under the <a href="https://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License.</a>
- MOD_FOOTER_LINE1
Customize those two Language Strings
- Go to System > Manage > Language Override
- Select the front-end language of your choice
- Click on New
- Search for the following Constant:
MOD_FOOTER_LINE1
- Click on the corresponding Result
- Change the Text by what you want, for example:
© %date% %sitename% | <a style="text-decoration: none;" href="/privacy">Privacy</a>
- Do the equivalent for
MOD_FOOTER_LINE1
- If you have a multilingual website, repeat this for each Language
If you want to have both Texts on the same Row on large screens (which is nicer I think) simply add the following CSS to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
This is not specific to Cassiopeia: that Footer was already there since the Mambo days I hear. But since Cassiopeia does not have tens/hundreds of Options, this is a very elegant way to get a nice customized footer.
4.4.4. Customizing the Blog View layout
Beyond the classical Options available in Joomla for the Blog View, Cassiopeia has some handy Classes that can be set in the Menu Item (of type Blog View) > Blog Layout tab > Article Class option:
- boxed
- image-right
- image-left
- image-alternate (in combination with image-right or image-left)
- image-bottom
For more information, see https://issues.joomla.org/tracker/joomla-cms/18319
Other Classes are also available in Cassiopeia which allow for example to have a “Masonry” Layout:
- columns-2
- columns-3
- columns-4
- masonry-2
- masonry-3
- masonry-4
See an example of masonry-3
on https://cassiopeia.joomla.com/sample-layouts/mansory-layout
I am not too sure about the use of columns-X
because there is now an Option #Columns (which was not there initially in the first drafts of J4)
4.4.5. Articles Images – Left, Center or Right
Joomla 4 has changed the float options for images: there is no select box with “right”, “left” or “none” anymore, but a field to insert a css class. Cassiopeia offer the classes “float-start” for positioning the full image on the left (on the right for rtl languages), “float-end” for positioning the full image on the right (on the left for rtl languages) and “float-none” for no floating.
Of course it is also possible to modify the position of the image using own css classes. Examples:
float-start
float-end
float-center
which would then be your own css definition in the/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0) file:
You can use the classes globally for all articles, go to Content -> Options -> Editing Layout and enter the class you want in the field “Full Text Image Class”.
Or you can use the classes on each individual article:
Source : Viviana on https://cassiopeia.joomla.com/help
4.4.6. Module Styles – card or noCard
- Go to Module > [ your module ] > Advanced tab > Module Style option
- There you see that Cassiopeia ships with two own Styles
- card
- noCard
Of course, you still have the standard Joomla Module Styles, namely
- html5
- none
- outline
- table
4.4.7. Changing the Layout ie moving Positions around
If you inspect a website using Cassiopeia you will see the following CSS:
This is CSS Grid. It is very easy and very visual as you can see. If you know little or nothing about CSS Grid, it is definitely worth learning the basic for example on https://css-tricks.com/snippets/css/complete-guide-grid/#prop-grid-template-areas
So if you would like to adapt the Layout and have for instance on desktop view
- the Position
banner
right after the component area - and the bottom Positions
bot-a
andbot-b
on the same row fifty-fifty
all it takes is to add the following CSS to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
With other words, the nice thing about having a template based on CSS Grid is that you can change the Layout just with a few lnes of CSS, without having to edit/override/fork any PHP file.
4.4.8. Changing the width of Left / Component / Right areas
4.4.8.1. Case 1 – when Cassiopeia’s Layout is set on Fluid
What determines the width of the columns in this case is the following CSS line (being CSS Grid):
Note the part in the middle, namely repeat(4,minmax(0,25%))
This is equivalent to minmax(0,25%) minmax(0,25%) minmax(0,25%) minmax(0,25%)
:
- The first
minmax(0,25%)
determines the width of the Left position - The last
minmax(0,25%)
determines the width of the Right position - And the two
minmax(0,25%)
in the middle make the 50% devoted to the Component area (being for example the selected Article)
So for example if I want to reduce Left and Right from 25% width to 20%, I would simply add the following CSS to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
4.4.8.2. Case 2 – when Cassiopeia’s Layout is set on Static
In this case, for a large screen (remember: Cassiopeia is Mobile First) what determines the width of the columns is the following CSS line (still CSS Grid):
Note the part in the middle, namely repeat(4,minmax(0,19.875rem))
(rem being a Relative Unit) This is equivalent to minmax(0,19.875rem) minmax(0,19.875rem) minmax(0,19.875rem) minmax(0,19.875rem)
:
- The first
minmax(0,19.875rem)
determines the width of the Left position - The last
minmax(0,19.875rem)
determines the width of the Right position - And the two
minmax(0,19.875rem)
in the middle make the 50% devoted to the Component area (being for example the selected Article)
So for example if I want to reduce Left and Right from 19.875rem to 9.875rem (but still keep the same total width), I would simply add the following CSS to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
Of course I could also very easily change the total width by playing with the sum of 4*19.875rem
4.5. Banner
4.5.1. Adding a Banner in Cassiopeia
See “Adding a Site header” on https://coolcat-creations.com/en/blog/customize-your-cassiopeia-template
4.5.2. How to Customize the height of the Banner Module
Simply adapt the following CSS to your needs and add it to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
4.5.3. How to add an overlay to the Banner Module
Simply adapt the following CSS to your needs and add it to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
4.5.4. How to add a Video Banner Module
Cassiopeia foresees a Banner Module having a background image, which takes about 50% of the viewport height.
For a website I wanted
- to have a Video in the background instead of a picture
- the video to take exactly the whole height of the browser
To do this
- create a basic Custom HTML Module without changing any of the Options
- paste the following HTML (adapt of course with your own video & image)
- paste the following CSS in
/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0)
HTML:
CSS:
4.6. Adding a custom Javascript
4.6.1. Option 1 – directly in user.js
- Just like you can create a custom CSS file in
/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0) - You can create a custom JS file in
/media/templates/site/cassiopeia/js/user.js
in J4.1+ (was/templates/cassiopeia/js/user.js
in J4.0)
Type for example the following code in user.js
and you will have a popup appearing in the front-end:
4.6.2. Option 2 – using a Child Template
This requires J4.1 (release date : 15 February 2022)
See in the Resources the presentations made by Dimitris.
- Go to System > Site Templates > Cassiopeia Details and Files
- Click on the Create Child Template button
- Close
- The Child Template is ready
- It can be seen next to the Parent Template in System > Site Templates
- You can customize it (create for example a file index.php at the root based on the original one but where you tweak/add something)
- Go to System > Site Templates Styles
- Make the Child Template default (or open it if you wish to customize the Options and/or Menu Assignemnts)
4.6.3. Option 3 – adding Options to Cassiopeia with a Child Template
By editing the Child Template XML file, you can easily add new Options to the Template (textarea, radio, …).
So then you can customize index.php, get this parameter and make something of it (like adding a Script in the Head)
<?= $this->params->get('myJS'); ?>
4.6.4. Option 4 – using an Module Alternate Layout
Actually with any Template and with any Joomla version, you can also very easily add any CSS or (inline or external) JS. The idea is to create a Module which will inject all the CSS & JS thanks to an Alternate Layout (Override). The advantage of this technique: you can
- use all the possible Assignments available in Modules so that the code is not loaded on all pages but only on the pages where it is necessary
- filter on language
- have a start/end date for publishing
- …
Here is the procedure
- Create an Override for the Module
Custom HTML
(note that you could actually use basically any other Module type)- Go to System > Site Templates > [ your template ] Details and Files
- Select the Create Overrides tab
- Click on mod_custom
- You get the confirmation message
Override created in /templates/cassiopeia/html/mod_custom
- Transform the Override into an Alternate Layout
- Select the Editor tab
- Click on /templates/cassiopeia > html > mod_custom > default.php
- Click on the Rename File button
- Give a name of your choice, for example
add-to-head
.php
- Edit the Alternate Layout
- Now instead of showing the “Content” of the Custom HTML Module we wil simply add some code which can add CSS and JS (inline of local/external files) to the Head of the page
- See for example the PHP hereafter (which you will want to adapt of course)
- See those interesting resources about Adding JavaScript and CSS in Joomla
https://docs.joomla.org/J3.x:Adding_JavaScript_and_CSS_to_the_page (addStyleSheet, addStyleDeclaration, addScript, addScriptDeclaration) - But there are even probably even better ways to do it “the Joomla4 way” (please get back to me if you can help improve this example)
https://docs.joomla.org/J4.x:Web_Assets
https://docs.joomla.org/J4.x:Http_Header_Management
https://www.joomlashack.com/blog/tutorials/web-assets-in-joomla-4/
- Create a Custom HTML Module
- Go to Content > Site Modules
- Click on New
- Select Custom
- Select the Advanced tab
- In the Layout option, select the Alternate Layout you have created (in this case
add-to-head
)
Arbitrary example of code for our Alternate Layout (adding an animation for .images, h2 and h3):
with the corresponding addition to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0) where all the animations would be defined:
4.6.5. Option 5 – for Bootstrap 5
Context:
- Joomla 4 ships with Bootstrap 5
- But to make your websites a.o. more performant, BS5 Javascript is not loaded by default
- Instead you can decide yourself in your child templates / overrides / alternate layouts to enable only what you need & where you need it
Suppose you need to use Tabs in a given Article. There copy-paste the following HTML (taken from the examples on https://getbootstrap.com/docs/5.0/components/navs-tabs/):
See the result in the front-end: the Tabs do appar, but clicking on the 2nd or 3rd Tab does not “do” anything.
This is because we still need to tell Joomla to load the Javascript for Tabs, namely via
You can easily add any Bootstrap Javascript to Cassiopeia by following the Official Documentation:
https://docs.joomla.org/J4.x:Using_Bootstrap_Components_in_Joomla_4
If you follow “Approach 3: Using a Template Override” don’t forget to add the Module Class bs-tab
to the Module you create and then the Tabs will be working.
4.7. Menu
4.7.1. How to Use the Menu with Cassiopeia in Joomla 4
- Vertical Menu in the Right Sidebar
- Horizontal Menu
- Moving the Menu to the Footer
See https://ltheme.com/use-the-menu-with-cassiopeia/
4.7.2. Adding an icon to a Menu Item – requires J4.1
- Search for an icon on https://fontawesome.com/v5.15/icons. For example
fas fa-envelope
andfar fa-envelope
(note: fas stands for Solid and far stands for Regular) - Go to Menu > [ your menu ]
- Click on the chosen Menu Item
- Open the Link Type tab
- Fill in the Link Icon Class option with the desired value, for example
fas fa-envelope
- See the result in the front-end
Txs to Christiane Maier-Stadtherr for this new feature added in J4.1
Note: this does not impose Font Awesome: it will work with any icon font the template wants to use (obviously the template would have to support an icon font for it to work)
More information on https://github.com/joomla/joomla-cms/pull/34658
4.7.3. Adding an icon to a Menu Item – before J4.1
In Joomla 4.0 you could reach a similar result in a manual way
- Add to the Menu Item a Link Class
my-icon-home
for example - Then add the following CSS to
/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0)
Besides this, you could also use only the icons mapped here as Font Awesome classes without further ado:
https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media_source/system/scss/_icomoon.scss
4.7.4. How to have a Hamburger Menu in Cassiopeia
See “Change the Menu Layout” on https://coolcat-creations.com/en/blog/customize-your-cassiopeia-template
4.7.5. Having Hamburger Menu before Logo on small screens even if it is after on big screens
Typically on a website you would have in the Menu Position the following modules in this order
- Logo (Custom HTML Module)
- Menu
- Language Switcher Module and/or Search Module
But on mobile view this is annoying because our Hamburger Menu (assuming we are using the Collapsible Dropdown Style for the Menu Module) stays “in the middle”. If you want to change the order and have that Hamburger Menu first, simply add the following to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
4.8. Accessibility
This is a J4 feature, not a Cassiopeia feature as such. But since Cassiopeia is conceived from scratch to be Accessible it is worth reminding those two features :
- enabling/configuring the Accessibility plugin (this adds the wheelchair icon at the bottom-left)
- Go to System > Manage > Plugins
- Search for
accessibility
- Edit the
System - Additional Accessibility Features
plugin - Select whether you want front-end and/or backend
- Set Status to Enabled
- Save
- enabling/configuring the SkipTo plugin (press Tab when opening a page or press Alt+9 any time in order to have dynamically generated links to all Menu Items but also all Titles and Modules)
- Go to System > Manage > Plugins
- Search for
skip
- Edit the
System - Skip-To Navigation
plugin - Select whether you want front-end and/or backend
- Set Status to Enabled
- Save
5. Some issues aka coming improvements
I spotted a few issues with Cassiopeia.
5.1. Issue 1 – the Hamburger Menu on small screens
On a website, you would typically have in the header
- the Logo
- the Menu Items
- the Language switcher and/or the Search
But on smartphone (more generally on small screens) even when using the Cassiopeia Collapsible Dropdown Menu, clicking on the Hamburger Menu gives something ugly:
- it pushes the rest of the header elements. In my example on this screenshot
- the logo is pushed to the right, according to the length of the longest Menu Item
- there is no room left for the Language Switcher so it comes on a new row
- and of course the content of the whole site is pushed downwards
- instead of having for instance a nice offcanvas
It seems that the “default” behaviour of Boostrap 5 is indeed to push the content down: https://getbootstrap.com/docs/5.0/examples/navbars/
But there is also an offcanvas solution: https://getbootstrap.com/docs/5.0/examples/offcanvas-navbar/
Can someone please help adding an Alternate Layout for the Menu Module in order to implement this offcanvas solution (which could then be a new Cassiopeia Alternate Layout of the Menu Module)? Txs!
Breaking news: Viviana Menzel is currently working on this. Give it a try!
See https://gist.github.com/drmenzelit/152a1954d73bcbe126194965e43c97f4
There are two Alternate Layouts: one for “default” menu and one for “metismenu”:
- The files should be copied into
/templates/cassiopeia/html/mod_menu
- There are a few lines of css to be added to
/media/templates/site/cassiopeia/css/user.css
in J4.1+ (was/templates/cassiopeia/css/user.css
in J4.0)
Please test and give your feedback!
5.2. Issue 2 – the Read More button partially hidden
[ edit 2022.02.10 – Viviana Menzel proposed a fix for this issue on https://issues.joomla.org/tracker/joomla-cms/36998 ]
On a Blog View, according to the lenght of the text and the viewport (mobile view), the Read More button is often partially or even totally hidden:
Viviana Menzel helped me with the issue, noticing that disabling the following CSS line fixes the issue on mobile view:
Since this line is useful on a wide screen and apparently has a side-effect only on mobile view we should probably simply add a media query to disable it or adapt it.
For example add the following to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
5.3. Issue 3 – Layout in Blog View
[ edit 2022.02.10 – Viviana Menzel proposed a fix for this issue on https://issues.joomla.org/tracker/joomla-cms/36998 ]
When using Article Class image-right
for a Blog View (1 column for instance), I noticed that the Images and Introtext would not display evenly: when the Introtext is too short for example when the Image on the Right comes next to the Text on the Left (instead of having a 50%-50% Layout).
Illustration with image-right image-alternate boxed
(but I double-checked: image-right
is enough to create the issue)
I did not have much time to investigate this but as a quick workaround I added the following to /media/templates/site/cassiopeia/css/user.css
in J4.1+ (was /templates/cassiopeia/css/user.css
in J4.0)
If you can investigate further and fix Cassiopeia for this it would be highly appreciated.
Some articles published on the Joomla Community Magazine represent the personal opinion or experience of the Author on the specific topic and might not be aligned to the official position of the Joomla Project
By accepting you will be accessing a service provided by a third-party external to https://magazine.joomla.org/
Comments 21
hello everyone
recently, I can't use any file manager in my joomla 4.1.
in FFexplorer 1.0.7 the error is--> init root folder error
in joomla 4.1 media manager--> a white screen appears
in JCE pro 2.9.20 file browser the error is -->The server returned an invalid JSON response.
so, when I want to create new article, I can't add image and file from my host. (NOTE : Previous contents of site, which included photos and files, are still well visible)
I've never had such a problem before.
I guess after update joomla from 4.0.6 to 4.1, this happened, but not sure
any recommendation has to resolve this problem?
thanks for your help
hello dear
that's awesome
I think, It was better, not to change the path from" template" to "media>template>site>...".
Some things have become commonplace, and changing them will lead to hardship and error.
This was not a change just for the sake of changing.
All Extensions must put their assets in the /media/ folder.
It was just not coherent (bc it is less secure!) to keep the template assets in the template folder.
Thank you for these valuable tips, Marc. I just did a test with the offcanvas mentismenu. I ask you to add the following to the above description:
- The offcancas menu must be selected in the menu module.
- If a child template with offcanvas-metismenu.php is used, the file dropdown-metismenu.php must also be copied to templates/NAME_CHILD_TEMPLATE/html/mod_menu.
In my view, this is a much better and more flexible solution than the standard metismenu.
Translated with http://www.DeepL.com/Translator (free version)
Hi Marc,
We've created a new Cassiopeia Child-template and added some great features as well. You might be interested in the new Child-template features. You can set custom colors and background images for all sections of the template. You can set font weight and various new fonts for the headings and default font of the Cassiopeia template. You can set different menu types and more. The template also supports Swiper Touch Slider. All files are free to download. We are also fixing some bugs in the default template. I won't add a link here so you don't delete my post. Please check joomlaportal(dot)cz/novinky/733-child-template-pro-cassiopeia-css-grid-a-navod-dil-3
Thanks for your feedback.
Frantisek
Txs a lot. Very interesting this installable Child Template and the additional Options
I have added the link to your resources at the end of my own presentation:
https://slides.woluweb.be/cassiopeia/cassiopeia.html#4-10-an-example-of-installable-child-template
Thank you.
Dear Marc, thanks for the great info collection!
One thing which does not work on my side though is the manual insertion of a link to "home" as described in:
https://magazine.joomla.org/all-issues/february-2022/joomla-4-cassiopeia-template-a-bunch-of-tips-tricks#4-4-2-how-to-have-the-logo-on-the-same-row-as-the-menu
I have a clean J!4 installation which I am currently experimenting on. Is this a bug of TinyMCE or Joomla? Or is it intended to be this way? One can avoid this problem by inserting the menu link to "home" like so: index.php?option=com_content&view=article&id=[ID], but is this user friendly?
Really, making a link to "/" in any Article for example should also lead to the homepage.
Disable TinyMCE (choose "no editor" in the General Configuration for example) so that you are sure.
...so I guess it is an editor problem/bug? Using Joomla for 15 years now, can't remember this happening. Was using JCE the last 10 years though... Anyway, this is not user friendly, especially if you are a new not webtec/joomla-savvy user. Is this the usual TinyMCE behaviour or should somebody file a bug report? If it is the usual behaviour then you might mention this in your post or adjust the description of how to do this?
There is no bug in Joomla or in TinyMCE (try it on a fresh website created for example on joomla.com).
So there is probably something at hand specific to your website.
If you share a link then people can have a look at it.
But use forum.joomla.org bc more people will see it and be able to hemp
BTW: if you are interested, you can find this here https://github.com/joomla/joomla-cms/discussions/38882
Will do, thank you. It is actually a fresh install on an online server, same clone/copy running locally on XAMPP - funny thing is, I just checkt locally and it is working as you explained, online not... hmmm, will investigate further
Have tried to center the images in Blog view using float-center as in 4.4.5 about but it doesnt seem to work??
User.css:
.float-centre.item-image {
text-align: center;
}
Inspector shows:
David Harewood & Zachary Quinto
http://jsr-dev.pwcbackup.com/index.php/julians-blog
What am I doing wrong?
http://colours.joomla.com/
Great and helpfull article Thanks Marc.
I suggest to add the link about a tool to generate custome colors for Cassiopeia.
Thanks for a great article Marc, very helpful!
I followed your tip under 4.4.2 to get logo and menu on same row.
They way it worked for me then was that on mobile screens the logo was on the left and the "burger menu" was aligned to the right which looks great. However when pressing the burger menu the "burger" part jumped to the left a bit to display the menu content. I guess one option is to use your tip under 4.7.5. I came up with another solution that has worked for me with the testing I have done and wanted to share it here if it helps anyone else.
I added the following to my user.css in my child template:
.navbar-toggler-right {position:absolute;right:0px;top:0px}
.navbar-collapse {margin-top:40px}
Slight update to my code suggestion after some more testing in case somebody wants to use it. Including realizing that the previous code messes up the menu when on larger screens where the "burger menu" is not used or could interfere with other menus on the page
New, modified code in my user.css:
@media (max-width: 767px) {
.header .navbar-toggler-right {position:absolute;right:0px;top:0px}
.header .navbar-collapse {margin: 40px 60px 0 0}
}
The right margin of 60px is optional and adjustable to your site. In my case some of my submenu items where too many characters to fit on the screen, i.e longer than the longest parent menu item, and I had to pull the menu a bit to the left to make them fit.
I have been looking for something like this for a while now. A great article you have there Marc, very helpful!
Thanks a lot! I am now looking for ways to make a more dynamic dropdown menu.
Re: 4.7.5. Having Hamburger Menu before Logo on small screens even if it is after on big screens
I just installed Joomla 4.2.8 and inserting the "@media" css into user.css as described has NO effect on my site. The hamburger doesn't move. Most of my user.css is generated via help of colours.joomla.com - but I inserted it at the bottom.
I was hoping to have the issues described in 5.1 but wanted to actually get the hamburger in the right position, first - before diving into 'breaking news' fix.