Questions tagged [head]
The head tag has no usage guidance.
73
questions
16
votes
5
answers
10k
views
What is the proper way of positioning/ordering CSS files in Magento 2?
In the Magento 2 DevDoc it says
To include a CSS file, add the <css src="<path>/<file>" media="print|<option>"/> block in <head> section in a layout file.
However it ...
10
votes
1
answer
11k
views
Magento 2: Change page titles
How do I change the page titles in the head section for each page? I would like to show: 'page title | site name'
7
votes
2
answers
32k
views
Add custom js in head in magento2?
I have custom module. I want add file my.js in folder app\code\Xanka\Slider\view\frontend\web\js\slider\my.js.
I used code in app\code\Xanka\Slider\view\frontend\layout\default.xml
<head>
&...
7
votes
1
answer
2k
views
How do I remove <meta name=... from head
How can i remove
<meta name="keywords" content="keyword"/>
from head through layout.xml?
7
votes
2
answers
2k
views
How to change the order of CSS files. Load module's CSS before theme's CSS in magento2?
I want to load all extension's css before custom theme css in <head> tag.
Right now extension's css file are loading after styles-m.css and styles-l.css
so I can not override the extension css ...
4
votes
2
answers
10k
views
Magento 2: How to add a meta tag based on layout
I have 3 main categories in my stores. In order to give them a general color theme, I created 3 layouts file in app/design/Vendor/Theme/Magento_Theme/page_layout, they are named category_white , ...
4
votes
1
answer
1k
views
Understanding $this->getIncludes()
I am using Magento 1.7. In head.phtml, the last line calls getIncludes(), like this
<?php echo $this->getIncludes() ?>
What exactly is this function including in the page head? I am not ...
3
votes
4
answers
2k
views
Set <head> title and script in Contact Page
I'd like to set the title and add some scripts in the default Magento Contact page . So in my theme's directory I have added the following file:
Magento_Contact/layout/contact_index_index.xml
<...
3
votes
1
answer
252
views
How to add custom js file before body tag in magento 2?
But script moving to inside body tag how to fixes this issue? Anyone
can help me for this
<referenceContainer name="head.additional">
<block class="Magento\Framework\View\...
2
votes
2
answers
4k
views
Magento 2: Add custom code before closing head tag
I am new to Magento.
I have some products in my Magento 2 website. I want to add some custom meta code before closing of head tag.
Example
if (page_id==1){
some code
}
if(page_id==2){
other ...
2
votes
2
answers
7k
views
Magento 2 : How to add custom meta tag in head
How to add custom meta tag in head tag of page-layout-2columns-left
custom meta tag l want to add is
<meta property="og:image" itemprop="image" content="url"/>
P.S.
I want this url to be ...
2
votes
2
answers
283
views
Magento 2: Include static resources (JavaScript, CSS, fonts) before </head>
How do i Include static resources (JavaScript, CSS, fonts) before in Magento 2?
i follow the docs magento 2 Include static resources (JavaScript, CSS, fonts)
i have copied the file from base theme ...
2
votes
1
answer
1k
views
Magento: how to use removeItem for js files added by extension programatically
I have a 3rd party extension adding JS in via an observer:
<?php
class Anowave_Owl_Model_Observer extends Mage_Core_Model_Abstract
{
public function dispatch(Varien_Event_Observer $observer)
...
2
votes
1
answer
40
views
Template implemetion error
I tried for a hours, but i can't find out. i created static block on header, and i tried to call the header out side of magento. I'm able to connect to magento, but the header is not showed. My code ...
2
votes
1
answer
726
views
Prepend block to Mage Head Block using controller_action_postdispatch event observer
I am trying to use a custom event observer to observe the controller_action_postdispatch event and modify the response body directly by replacing opening head tag with + my custom block content. It ...
2
votes
0
answers
124
views
Magento 2.2.8 not saving HTML head
Just upgraded to 2.2.8. Trying to add something into HTML head section, but it does not go to the front-end. At the same time enabling "Display Demo Store Notice" did work.
Tried cleaning & ...
2
votes
1
answer
357
views
Add extra line to head section with url as a variable
I want for every page an additional line in the head section.
The extra line should look like this: <link rel="alternate" href="https://www.mywebsite.com/us/link.html" hreflang="en-US"> where "...
2
votes
0
answers
2k
views
Change order of CSS and JS in the <head> section of the page
Where is the block with CSS and JS in the <head></head> rendered? And how to change the order of the elements from that section?
(this screenshot is from Magento 2 demo)
I'd like to ...
2
votes
1
answer
601
views
Rewriting Html Head Block
Anyone have any idea why I can't rewrite the Mage_Page_Block_Html_Head block?
My config.xml file looks like this:
<config>
<modules>
<Mymodule_Robots>
<...
1
vote
5
answers
8k
views
Add google tag manager code inside head and body
I have a question regarding magento. I would like to know where the head and body are located. I want to do this because i would like to add a Google tag manager code inside it. I can somehow not seem ...
1
vote
2
answers
10k
views
Adding <referenceBlock name=“head.additional”> Magento 2 not working
I had these blocks in the frontend layout:
<referenceContainer name="content">
<block class="Dfl\Marketplace\Block\Profile" name="marketplace_sellerprofile" template="profile.phtml" ...
1
vote
3
answers
6k
views
Adding New Facebook pixel to <head>
Trying to add the new Facebook pixel to Magento 1.9.1.1. So it can appear on all pages.
I have added the following to app/design/frontend/rwd/CustomTheme/layout/local.xml between
<?xml version="...
1
vote
1
answer
812
views
Magento 2.1.5 Theme not loading correctly (worked perfect in 2.1.2)
We have updated our magento 2 installation from 2.1.2 to 2.1.5.
Everything went fine, except for the layout.
Somehow Magento doesn't load some parts of our custom theme anymore? For example the file:
...
1
vote
1
answer
326
views
equivalent class for Mage_Page_Block_Html_Head
what is the equivalent class for Mage_Page_Block_Html_Head in magento2?
I'm finding Magento\Theme\Block\Html\Header.
But there is no class related to Head.php
Update:
<?php
/**
*
*/
class ...
1
vote
1
answer
891
views
Magento2 css from module isn't loading
I want to load a custom css file for the admin panel from a custom module folder.
My layout xml file looks like this
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
1
answer
99
views
How do I insert javascript immediately following the <head> opener, but only on the homepage? (Google Analytics AB Testing setup)
I'm fairly new to Magento development.
How can I insert code immediately following (not before ) on the index/home only?
I'm trying to insert some JavaScript for a Google Analytics Content ...
1
vote
1
answer
2k
views
How to add custom css and js files after certain default ones
We know that all css/js files added by page.xml in default handle are global, they're loaded in all pages.
When I add some css and js files in specific handle (eg. catalog_category_default), they're ...
1
vote
3
answers
880
views
Add external stylesheet link-rel head tag
Knewb here, I want to add external stylesheets via link rel to the head tag list of my store in version 1.9. I am also using Ultimo theme.
Can it be done?
What is the name of the file I am ...
1
vote
1
answer
1k
views
how can I append custom block to head in adminhtml controller action
I was trying to add a block to the head in magento backend for a specific controller action.
public function updateAction(){
$block = $this->getLayout()->createBlock(
'...
1
vote
2
answers
416
views
Magento : Edit Head Tag of Specific Page
I'm trying to setup an Analytics A/B test on my Magento, on 2 landing pages (not homepage).
The problem is that, if I place Google Analytics Content Experiment code on every page of store, it re-...
1
vote
3
answers
510
views
Add js file in two colums layout
I'm trying to add a sript for sidebar only where the sidabar appear.
In my local.xml I added:
<page_two_columns_left>
<reference name="head">
<action method="addItem">&...
1
vote
1
answer
1k
views
Adding code to the head section of homepage only
How do I add code to the head of my homepage only? I did some research and I think it needs to go into layout.xml under but it doesn't seem to be showing. My code with this added is below:
<...
1
vote
2
answers
455
views
what does this piece of javascript do and can i remove it safely?
<script type="text/javascript">//<![CDATA[
var Translator = new Translate({"HTML tags are not allowed":"HTML-code is niet toegestaan","Please select an option.":"Selecteer a.u.b. een ...
1
vote
0
answers
49
views
Magento 2.3 How add additional links in tag <head>?
How to add information to the tag, please tell me?! I want to add .phtml file
I can change the class along this path and add this way, but it seems to me that there is another way
Magento\Framework\...
1
vote
0
answers
157
views
Magento2: How to add css file in admin backend for RTL?
I want to add custom css in backend that only work when user change the Arabic language from admin side.
How can I add css for backend on conditional basis?
Can any one help me on this which would ...
1
vote
0
answers
905
views
Remove a link tag in head tag
I never used Magento and a client of mine asked me to remove an unwanted google adsense in his website.
While inspecting, I got this:
<link rel="preload" href="https://adservice.google.com.br/...
1
vote
1
answer
110
views
How to find which extension is adding a specific <script> to <head>
I'm having some extension adding in a script element to the head with a broken URL that keeps on 504'ing. This is occurring on a test server where I don't have full FTP permissions so editing files ...
1
vote
3
answers
5k
views
Add custom js to magento 2 after jquery
I try to add a custom js to magento 2 head, but after the jquery.js.
Or is there a way to add the custom js file to the footer?
I have tried in the default.xml but it's over the jquery.js
This is my ...
1
vote
1
answer
306
views
Sort CSS files in Head [duplicate]
I am developing a Magento 2.1.2 shop based on the Bootstrap library.
But the Bootstrap library should only get included in cms pages. So I added the following code in the file Magento_Cms/layout/...
0
votes
4
answers
6k
views
Adding TypeKit code (or any code) into the Head of a Magento 2 site
All I want to do is to add a custom font from TypeKit into my Magento 2 website.
Previously I just used to find /app/design/frontend/XXX/XXX/page/head.phtml and edit that. Simple.
With Magento 2 it ...
0
votes
4
answers
3k
views
Add inline javascript to head - magento2
I am struggling to load a script tag on my Magento website. I am trying to add this to the head by adding the below code. I have tried to add this to the default.xml and default_head_blocks.xml
&...
0
votes
2
answers
1k
views
Can't get a head block in Observer
I don't know why but i get this error: Call to a member function setData() on boolean in observer line 22, and this line is: $head->setData('title', $metaTitle);
Observer.php
class ...
0
votes
1
answer
531
views
Add tag "noscript" in HEAD for CSS files ( Magento 2)
I want to add tag "noscript" in head.
<head><noscript id="deferred-styles">
<link rel="stylesheet" type="text/css" media="all" href="http://dev.magento2.com/magento2/pub/static/...
0
votes
1
answer
4k
views
HTML Head issue using Magento2
I've an issue with Magento 2: please Help!
I've added some HTML code in:
Content > Design > Configuration > Theme Edit > HTML Head
The code doesn't work (it's ok, no worries for me, ...
0
votes
2
answers
66
views
Magento plugin help
First of all, i'm new to magento, i've read a few books and tried google before posting my problem.
Our company has a widget which we want to make available on the magento store, I have so far ...
0
votes
1
answer
2k
views
Magento Custom head content for Individual pages
Google Webmaster Tools and marketing suppliers, pricecomparision suppliers, Google Analytics, Facebook Ads etc. etc.... all wants their individual codes inplemented on convertion pages. Not on all ...
0
votes
1
answer
8k
views
Adding JS File in head.phtml
I'm trying to add a js file to the head section of my file and am not sure if I'm following procedure here. What I have done is gone into the head.phtml file and placed the path to the js file below ...
0
votes
1
answer
418
views
How to Get block 'head' description in Magento 2?
In magento 1.9 i can get the page head description like this in phtml:
$this->getLayout()->getBlock('head')->getDescription()
How can i achieve this in Magento 2 ?
0
votes
1
answer
848
views
Magento 2 How to exclude Head Miscellaneous Scripts section from deferred?
I am using a free extension for defer javascript Magento 2 Defer Parsing of JavaScript, which is working fine.
But when I am adding Miscellaneous Scripts in magento admin from head section which is ...
0
votes
1
answer
827
views
Magento2: Can we add current URL in "Scripts and Style Sheets"?
I want to add Dynamic URL in Admin->Content->Design->Configuration->HTML Head->Scripts and Style Sheets?
Actually, I want to add canonical tag throughout the website.
Here is the code:
<link rel=...