Skip to main content

Questions tagged [head]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
128 views

Override the canonical URL in custom layout handler

I'm attempting to override the canonical URL for a custom handler. I tried adding the following code via XML, but instead of overriding the default canonical URL, I now have both the default and the ...
Anass Hl's user avatar
  • 101
0 votes
0 answers
152 views

I'm adding gtm tag in magento 2 in head from admin but it is showing inside body why?

I'm adding gtm tag in magento 2 in head from admin but it is showing inside body why? All script tag are moving in body I have (Move JS to bottom from yes to No) but it is showing in body.
kashif sohail's user avatar
0 votes
1 answer
824 views

magento 2: Add custom <script> tag in <head> section, only for specific CMS page

I have a CMS page in Magento 2, for which I want to add <script> tag that will be included in the <head> section of this page only. I do not want this <script> tag to appear on any ...
Kade's user avatar
  • 1
0 votes
1 answer
641 views

Magento 2 - Custom Head PHTML showing in body

I am trying to create dynamic head using phtml on Magento 2.3.5 p1. I am inserting in default.xml the following: <page> <body> ... <referenceContainer name="head.additional&...
archigrafix's user avatar
0 votes
1 answer
442 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 ?
Tiny Dancer's user avatar
3 votes
1 answer
254 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\...
jykmhar123's user avatar
0 votes
1 answer
291 views

Position a block at the top of <head>

I'm using the following to add tags to my : <referenceBlock name="head.additional"> <block class="Magento\Framework\View\Element\Template" name="head.font&...
Sam's user avatar
  • 163
0 votes
1 answer
162 views

How to add js right before head tag end

I want to add js EXACTLY right before end of head tag I've try this solution, but it only put the js to middle of the head tag, not right before end of head tag https://magento.stackexchange.com/a/...
fudu's user avatar
  • 1,298
0 votes
1 answer
1k views

Magento 2 - How to add external css/script to head?

I try to add external css/javascript to the head. I added this to my theme under Magento_Theme\layout\default_head_blocks.xml: <?xml version="1.0"?> <page xmlns:xsi="http://www....
Black's user avatar
  • 3,431
1 vote
0 answers
50 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\...
David Young's user avatar
1 vote
0 answers
158 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 ...
Purushotam Sharma's user avatar
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 ...
John's user avatar
  • 75
0 votes
1 answer
682 views

Magento 2.3.1 - Issue with script Google Tag Manager (GTM) in <HEAD>

I am trying to implement GTM in magento 2.3.1. But i could not able to make it successful. I have used the extension WeltPixel Extension to configure GTM to my site and manually method too but when ...
Erick Amoedo's user avatar
0 votes
1 answer
860 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 ...
Vinod Kumar's user avatar
  • 2,065
2 votes
0 answers
126 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 & ...
Alex Ambal Mulin's user avatar
2 votes
1 answer
363 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 "...
Ernest's user avatar
  • 21
0 votes
1 answer
542 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/...
Pukhraj Suthar's user avatar
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 <...
zekia's user avatar
  • 660
0 votes
1 answer
254 views

Bootstrap 4 and IE11

why my BT4 isn't working on IE11 ? In default_head_block.xml I have this : <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/...
Morgan's user avatar
  • 945
1 vote
3 answers
890 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 ...
Starkemp315's user avatar
0 votes
1 answer
834 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=...
Ravi Soni's user avatar
  • 1,819
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 ...
Pradeep Sanku's user avatar
0 votes
1 answer
138 views

I have magento 1.9.4 and running 3 stores and want to add a jv script from duda in the head

It says to add this to the head section but I don't know where it is. This is the script. DM_redirect("m.stuffwholesale.com"); I looked at the phtml which I found in the forum but I just am unsure can ...
Ron Gin's user avatar
  • 31
0 votes
2 answers
343 views

Magento 1.9.2.4 How to remove Link Rel Stylesheet from head section on custom theme

So we have a site and when i view source there is a Link Rel="stylesheet" line entry which fetches a stylesheet. When i click this link in view source it leads to empty page as in not found, so i want ...
Matt Godwin's user avatar
2 votes
2 answers
287 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 ...
mindsoul's user avatar
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 &...
lky's user avatar
  • 797
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 ...
PЯINCƎ's user avatar
  • 11.7k
1 vote
0 answers
909 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/...
Flaviano's user avatar
0 votes
1 answer
38 views

Any configuration for type of style section loaded in head tag?

Is there any configuration that makes style section loaded like this in head tag: <style data-href="http://www.website.com/pub/static/frontend/Mytheme/mytheme/fr_FR/mage/calendar.css" media="all"&...
Mirindra's user avatar
1 vote
1 answer
127 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 ...
T_K's user avatar
  • 48
0 votes
1 answer
1k views

Add JS to head in Cart

I have a problem when I want to put JS into my head when the PHP condition is met, but I'm getting Mage_Core_Exception: Invalid block type exception no idea why. I have read all the possible issues I ...
JohnyProkie's user avatar
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 ...
zitix's user avatar
  • 2,192
0 votes
0 answers
4k views

Magento2: How to add code inside the head tag?

I'm working on a Magento 2 website and I'm trying to add some code to the head tag, I already tried to add going to Content->Configuration->HTML Head and pasting the code inside "Scripts and ...
RuiVBoas's user avatar
  • 195
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 ...
Kevin's user avatar
  • 13
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" ...
Hugo Rojas's user avatar
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( '...
gabtzi's user avatar
  • 686
1 vote
2 answers
417 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-...
Luca's user avatar
  • 11
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 ...
user3778868's user avatar
1 vote
1 answer
817 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: ...
Xaiamedia's user avatar
  • 351
0 votes
2 answers
1k views

Magento 2 : How to Add Dynamic CSS Url

I need to add custom css in head dynamically, where css url is dynamic. I can add using below code but page will get cache, I need to add css dynamically each page re-fresh, css url will be also ...
Pradeep Kumar's user avatar
0 votes
0 answers
203 views

Adding script that is not in a .js file in the <head> Magento 2 without using 'misc scripts' in admin

I have some js script which I'd like to place in the section of my Magento 2 site. I do not want to add in 'miscellaneous scripts' section. I want to add this in my themes default.xml file. However, ...
YorkieMagento's user avatar
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, ...
Lukastdesign's user avatar
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/...
Baworder's user avatar
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 ...
LeCodeur's user avatar
  • 366
0 votes
1 answer
38 views

How do I add a js reference to the body of my page and a css reference to the head of my page?

The only place I have access to edit is: CMS > Pages > 'page' > Content Can I add a jquery reference to the body of my page like this in the content area? <body> <script src="js/jquery.min....
user3884406's user avatar
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 ...
Dipesh Rangani's user avatar
4 votes
2 answers
11k 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 , ...
Memes's user avatar
  • 708
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 ...
Raj Mohan's user avatar
  • 238
0 votes
1 answer
78 views

Magento invoice printing error after a custom theme installed

My problem is printing invoice issue,I noticed that this started since i installed a new theme, i installed a theme (from EMThemes website) and whenever i try to print a sales invoice from the ...
Powhattan's user avatar
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'
MikeMason's user avatar
  • 1,357