New links in default_head_blocks.xml never show up - magento

I want to add a few links in a Magento 2 store's head element, to serve a favicon bundle (OS specific link icons etc). In my theme directory I've added a new default_head_blocks.xml:
./app/design/frontend/MyTheme/std/Magento_Theme/default_head_blocks.xml
With following content:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
<meta name="theme-color" content="#ffffff">
</head>
Problem is, these tags never show up in the html. I've added a default.xml in the same folder to remove the standard Report Bugs link and that link vanished faster than my salary on a Friday.
I can also browse the image URLs manually to get the icon images. But still, the links never show up.
What am I missing here?
PS. Must point out that the theme inherits Blank.

Problem solved. The link elements shall have a src attribute instead of a href. And if one element fails, all fail. This code works:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link rel="apple-touch-icon" sizes="180x180" src="favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" src="favicon/favicon-32x32.png">
<meta name="theme-color" content="#ffffff">
</head>

Related

a href not working with a bare web page

I've been looking around for a solution to the problem I'm having, but it seems that none of the solutions on SO address my issue.
I was having the dreaded issue where the a href tag in my HTML does not actually take me to the link. At first, I tried removing the JavaScript includes, wondering if something in the JavaScript portion was messing up the page.
Then I removed the CSS portion as well, and ultimately removed everything until the page consisted of simply the header information for the HTML page and only the a href tag. I also changed the link to a non-existent page (to force a 404 error).
When clicking on the link, it keeps me on the current page and doesn't take me to the referenced page (or even give me a 404 error). Following is the stripped out code (everything but the commented out portion):
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>test</title>
<meta name="description" content="test1" />
<meta name="keywords" content="test2" />
</head>
<a href="test.html">Support</a/>
</html>
Thanks for the help.
I made the changes based on the answers given but still see the same behavior. As seen in the screenshot (sorry SO doesn't let me insert images), the URL shows /test.html but the page is still the main page. I changed the text of the link to ensure that the changes were applied.
I'm using rackup to quickly view the changes locally.
Screenshot
Updated code:
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>test</title>
<meta name="description" content="test1" />
<meta name="keywords" content="test2" />
</head>
<body>
Support2
</body>
</html>
Working and tested:
NOTE: Both files [ current one and test.html ] are in same directory.
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>test</title>
<meta name="description" content="test1" />
<meta name="keywords" content="test2" />
</head>
<body>
Support
</body>
</html>
Also test code is working fine using target="_blank" in anchor tag , which open link in new page if working fine, like below:
<a href="test.html" target="_blank" > support </a>
You have an extra slash in your closing a tag.
Should be
</a>.
I would also make sure they are in the same directory.
Apparently the answer was here:
How to setup URLs for static site with Ruby Rack on Heroku
Individual pages were being routed to "/" all the time. Needed to modify "config.ru" to get routing to work properly.
Next step is to look into "sinatra".

Where to find the viewport meta tag on Magento?

Actually I need to make an magento site non-responsive, I'm trying to find the viewport meta tag in head file but it's not there. Please let me know where can I find this?
Please check this file.
\app\design\frontend\base\default\template\page\html\head.phtml
But if you are using the custom theme, you must find out that file in your theme.
So like this :
\app\design\frontend\default[Your theme]\template\page\html\head.phtml
Override or create file in theme and add below code in your theme
/vendor/magento/module-theme/view/frontend/layout/default_head_blocks.xml
to
/app/design/frontend/Your/Theme/Magento_Theme/layout/default_head_blocks.xml
and add your viewport tag in section
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/framework/Module/etc/module.xsd">
<head>
<!-- your meta viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1, user-scalable=no" />
</head>
</page>
this will update your default magento tag

favicon not showing on inner pages of magento

In one of my magento website I have added favicon using
magento admin panel > system > configuration > design > HTML head > favicon icon
It was displaying nicely in magento home page but not showing in inner pages. I have changed the current configuration scope to store view and did the same proccess. still it is not working. I hacve cleared caches and re-indexed. but it is not working.
Why is it so? How can I solve this?
Thank you.
# jatinder kumar you may need this only?
<link rel="icon" href="http://navaani.in/media/favicon/stores/17/favicon_1.png" type="image/x-icon">
<link rel="shortcut icon" href="http://navaani.in/media/favicon/stores/17/favicon_1.png" type="image/x-icon">
<link rel="shortcut icon" href="http://navaani.in/skin/frontend/base/default/images/dresscode_images/favicon.ico">
<link rel="apple-touch-icon" href="http://navaani.in/skin/frontend/base/default/images/dresscode_images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="http://navaani.in/skin/frontend/base/default/images/dresscode_images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="http://navaani.in/skin/frontend/base/default/images/dresscode_images/apple-touch-icon-114x114.png">
<link href="//fonts.googleapis.com/css?family=Amaranth:200,300,400,500,600,700,800" rel="stylesheet" type="text/css">
Ask me if you want more. Thank you.
We experienced similar. We resolved this (if I'm understanding your issue correctly) by overwriting the default favicon.ico in the root folder with ours.
Note, browser caching in relation to favicon.ico is extremely zealous :) As such, you will probably only see the change by opening the site in a browser you haven't opened the site in previously or on a different machine.

Jekyll Deployment on Github Pages doesn't format correctly and links broken

I am learning about how to use Jekyll and Github recently and I am having a hard time getting my website to display correctly online but it does display correctly locally when I run:
jekyll serve --baseurl ''
My Github repo that I am working on is http://yungkickz.github.io/kingwizard
Github Tree
Any help or hints would be super helpful.
Edit: Basically this entire website is missing the correct CSS and links are pointing to the wrong place; especially the first Home and About link as any the other links were made to just test.
My config.yml:
name: kingwizard
description: wizardly blog
paginate: 5
url: "http://yungkickz.github.io"
baseurl: /kingwizard
markdown: rdiscount
Also here I've added the beginning of the html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ site.description }}">
<meta name="author" content="">
<title>{{ site.name }}</title>
<!-- Bootstrap core CSS -->
<link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
<!-- Custom Arreis Style -->
<link href="{{ site.baseurl }}/css/custom-style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="{{ site.baseurl}}js/html5shiv.js"></script>
<script src="{{ site.baseurl}}js/respond.min.js"></script>
<![endif]-->
</head>
Judging from the source code of your site, I have noticed some issues:
Many of your references to HTML, CSS, and JavaScript files begin with //. It seems like site.baseurl is set to / on GitHub for some reason, despite the setting in your config file. However, you often add addition slashes after site.baseurl in paths, which causes the second slash to appear.
Because site.baseurl is /, browers will expect to find your files at http://yungkickz.github.io/SOME_PATH. However, your site is actually deployed to http://yungkickz.github.io/kingwizard, so your links should be pointing to http://yungkickz.github.io/kingwizard/SOME_PATH instead.
Because of the 404 errors, your CSS styles are not loaded, which is why your site looks like it isn't formatted correctly.
Before:
<link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
After:
<link href="/kingwizard/css/bootstrap.css" rel="stylesheet">

VS Annoying CSS Alert

<link href="http://www.../default.css" rel="stylesheet" type="text/css" />
Could not edit 'http://...' because it is not in the Web site.
I get this error box every five minutes, how do I get it to stop telling me this?
<link runat="server" id="defaultCss" rel="stylesheet" type="text/css"/>
and on your code behind
defaultCss.attributes.add("href","http://www..../default.css");
if your css is in your website then you can use
ResolveUrl("~/default.css")
to get the url
or probably best practice is to add it to your app theme folder http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx and then not only will it be automatically added but you'll get intellisense
Well, seems like it's because you're including an href that points to a URL, instead of a relative web path.
Instead of
<link href="http://www.mysite.com/styles/default.css" rel="stylesheet" type="text/css"/>
use
<link href="/styles/default.css" rel="stylesheet" type="text/css"/>
Also, make sure your closing
/>
is valid in terms of your Doctype.

Resources