Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom index.html for nuxt.js build

Tags:

vue.js

nuxt.js

Sorry if this is asked, just not sure what to search for. Is there a way to change the template that's used to generate the index.html file when building a Nuxt app in spa mode?

like image 435
Leo Avatar asked Nov 08 '19 22:11

Leo


2 Answers

For overwriting the .nuxt/views/app.template.html, you need to create app.html file at the root of the project. You can then, copy-paste the general content from app.template.html and start modifying things.

For eg - I have to add the lang attribute to the html tag, so I have updated the code a bit in my app.html

app.html

<!DOCTYPE html>
<html lang="en" {{ HTML_ATTRS }}>
  <head {{ HEAD_ATTRS }}>
    {{ HEAD }}
  </head>
  <body {{ BODY_ATTRS }}>
    {{ APP }}
  </body>
</html>
like image 158
Yashwardhan Pauranik Avatar answered Oct 09 '22 23:10

Yashwardhan Pauranik


Like @Ohgodwhy said There is no index.html with nuxt.

But you can change everything that you want with vue-meta that is used by default in nuxt see more : https://nuxtjs.org/api/pages-head/

like image 1
Pierre Said Avatar answered Oct 10 '22 01:10

Pierre Said