Skip to content

Instantly share code, notes, and snippets.

@robertkowalski
Created December 4, 2012 17:17
Show Gist options
  • Save robertkowalski/4206422 to your computer and use it in GitHub Desktop.
Save robertkowalski/4206422 to your computer and use it in GitHub Desktop.
adding meta tags to head with javascript
var meta=document.createElement('meta');
meta.name='viewport';
meta.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0');
document.getElementsByTagName('head')[0].appendChild(meta);
@ayushxx7
Copy link

ayushxx7 commented Sep 4, 2020

I had the option to add the tag using article_page.hbs file. This file runs on every article in my Zendesk Help Center.
All I had to do was add the following to the beginning of that file:

{{#each article.labels}}
{{#is identifier 'noindex'}}<meta name="robots" content="noindex">{{/is}}
{{/each}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment