Home > Enterprise >  Vue / Nuxt - Add really specific tag to <head>
Vue / Nuxt - Add really specific tag to <head>

Time:09-29

I'm generating static page templates using Vue/Nuxt and I can't figure out if there's any way to add a really specific tag into the of each page that is generated. It isn't a meta, script, style or link - and it seems the only default ways in nuxt.config.js are for scripts, links or meta tags. These are the tags that need to be injected in:

<v65:metaTags></v65:metaTags>
<v65:customFile file="/v65html/_headassets.htm"></v65:customFile>

Those tags are generated from the CMS system and unfortunately need to be on every page. Thanks.

CodePudding user response:

In nuxt you can overwrite the default .nuxt/views/app.template.html.

You need to create app.html file in the root of the project. Then put the below code inside this file:

app.html

<!DOCTYPE html>
<html lang="en" {{ HTML_ATTRS }}>
  <head {{ HEAD_ATTRS }}>
    {{ HEAD }}
  </head>
  <body {{ BODY_ATTRS }}>
    {{ APP }}
  </body>
</html>

Then you can put any tag you want in head tag.

<!DOCTYPE html>
<html lang="en" {{ HTML_ATTRS }}>
  <head {{ HEAD_ATTRS }}>
    {{ HEAD }}
    <v65:metaTags></v65:metaTags>
    <v65:customFile file="/v65html/_headassets.htm"></v65:customFile>
  </head>
  <body {{ BODY_ATTRS }}>
    {{ APP }}
  </body>
</html>
  • Related