Skip to content

Instantly share code, notes, and snippets.

@lockevn
Created July 26, 2020 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lockevn/37d908e075d17a008e6e3bc267360029 to your computer and use it in GitHub Desktop.
Save lockevn/37d908e075d17a008e6e3bc267360029 to your computer and use it in GitHub Desktop.
Inject an inline JavaScript in to head of page rendered by Nuxt
/**
* All of these can be overrided in each page component via define method https://nuxtjs.org/api/pages-head/
* E.g.: head() { return { title: "", meta: [] } }
*/
export default {
titleTemplate: "%s - " + _WhiteLabel.brandname,
title: "Shop",
meta: [
{ "http-equiv": "utf-8" },
{ charset: "X-UA-Compatible", content: "IE=edge" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "keywords", name: "keywords", content: _WhiteLabel.keywords },
{ hid: "description", name: "description", content: _WhiteLabel.description },
],
link: [
{ rel: "icon", type: "image/x-icon", href: `${process.env.WHITELABEL_CODE}/images/favicon.png` }
],
__dangerouslyDisableSanitizers: ["script"],
script: [{ innerHTML: `var process = process || { env: {WHITELABEL_CODE : "${process.env.WHITELABEL_CODE}"}};console.log(process.env);`, type: "text/javascript", charset: "utf-8" }]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment