meteor-starter
meteor-starter copied to clipboard
Problem adding manifest link in header
This is probably because of some module used, but hopefully someone can help me out. I am making a web app and I need to link in a manifest file.
On a vanilla meteor I can do:
<head>
<title>test</title>
<meta name="mobile-web-app-capable" content="yes">
<link rel="manifest" href="/manifest.json">
</head>
When I do the same however on a fresh meteor-starter, for some reason the meta name="mobile-web-app-capable"
and the link rel="manifest"
are removed from the <head>
section.
When I add a link rel="icon"
however, it is not removed, which is the expected behavior.
So what makes those head tags disappear? Should I set somewhere what head tags are whitelisted?
Right now I use this workaround, but it is ugly:
Template.masterLayout.onRendered(function() {
$('head').append('<link rel="manifest" href="/manifest.json">');
$('head').append('<meta name="mobile-web-app-capable" content="yes">');
});
Are you doing this in client/index.html
file? If not try edit <head>
tag in that file.
Yes, I do it in client/index.html
.
Just try it on a fresh install. You'll see these tags are ignores.
Tags are in the markup returned from the server (you can see it with "View Page Source" on chrome) but disappear when inspected with chrome dev tools. Strange but it looks for meteor or chrome dev tools issue.
You're right.
I just checked and I can confirm this.
This is really strange. In Firefox I see exactly the same behavior. So probably it's not the dev tools.
Another strange thing is that I see the <title>
tag twice in de header. Maybe it's related.
I'm getting a strange behavior too on using:
<link rel="manifest" href="/manifest.json">
In the console, it reads:
"Manifest parsing error: Line: 1, column: 1, Unexpected token."
So i tried removing the manifest file and it threw the same error regardless of the file being present or not.
Then I open up /manifest.json
from the dev tools, and it seems meteor is responding to /manifest.json
with the application template itself.
So far I have no idea why I'm not able to load the manifest.json, I just started learning meteor last week. Am i missing out something?
The package manuelschoebel:ms-seo is messing with this. I found in my own project it is removing the link from the header before the browser gets it.
I'm not using this package but just had similar, if not the same, issue where link rel='manifest'
gets removed. As JProgrammer had mentioned, the issue was caused by manuelschoebel:ms-seo package. To fix the issue, you can try to use this option: https://github.com/DerMambo/ms-seo#using-ignore
The solution here is to add the manifest details to the default config for the package.
// set default config for SEO package
return SEO.config({
title: "",
meta: {
title: "",
description:
"",
site_name: "",
viewport: "",
},
og: {
title: "",
site_name: "",
},
link: [
{
home: "",
},
{
rel: "manifest", href: "/manifest.webmanifest"
},
]
});