<jdoc:include type="head" /> causes error:

General questions relating to Joomla! 5.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
SocketPup
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 134
Joined: Thu Mar 14, 2024 7:00 am

<jdoc:include type="head" /> causes error:

Post by SocketPup » Sun Apr 07, 2024 7:50 am

In my index.php of my custom template, I use the following code for my Head:

Code: Select all

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your Website Title</title>
    <jdoc:include type="metas" />
    <jdoc:include type="styles" />
</head>
This all works well, but I learned there is a special Head for Joomla:

Code: Select all

<jdoc:include type="head" />
However, when I tried to implement it like so...

Code: Select all

<head>
    <jdoc:include type="head" />
</head>
...my page no longer works, instead I get the error:
0 - WebAssetManager is locked, you came late
What's causing this, and how do I fix it?

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9914
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: <jdoc:include type="head" /> causes error:

Post by AMurray » Sun Apr 07, 2024 10:01 pm

I don't know what this refers to

Code: Select all

<jdoc:include type="styles" />
I found the following resources that may be useful: https://docs.joomla.org/J4.x:Web_Assets, and for reference, this older post discussing the same error message: viewtopic.php?t=990772 may be of some use.
Regards - A Murray
General Support Moderator

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2794
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: <jdoc:include type="head" /> causes error:

Post by ceford » Mon Apr 08, 2024 5:54 am

I think that <jdoc:include type="head" /> was used in Joomla 3 but was replaced in Joomla 4 by three separate include statements:

Code: Select all

    <jdoc:include type="metas" />
    <jdoc:include type="styles" />
    <jdoc:include type="scripts" />

SocketPup
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 134
Joined: Thu Mar 14, 2024 7:00 am

Re: <jdoc:include type="head" /> causes error:

Post by SocketPup » Mon Apr 08, 2024 6:35 am

ceford wrote: Mon Apr 08, 2024 5:54 am I think that <jdoc:include type="head" /> was used in Joomla 3 but was replaced in Joomla 4 by three separate include statements:

Code: Select all

    <jdoc:include type="metas" />
    <jdoc:include type="styles" />
    <jdoc:include type="scripts" />
I see. Maybe I should keep it as is then.

SocketPup
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 134
Joined: Thu Mar 14, 2024 7:00 am

Re: <jdoc:include type="head" /> causes error:

Post by SocketPup » Mon Apr 08, 2024 6:36 am

AMurray wrote: Sun Apr 07, 2024 10:01 pm I don't know what this refers to

Code: Select all

<jdoc:include type="styles" />
I found the following resources that may be useful: https://docs.joomla.org/J4.x:Web_Assets, and for reference, this older post discussing the same error message: viewtopic.php?t=990772 may be of some use.
I need to use that line in order for my custom css to be added into my index.php (just referring to it in the xml doc does nothing)


Post Reply

Return to “General Questions/New to Joomla! 5.x”