<!DOCTYPE html>
<html lang="en">
{{ partial:head }}
<body class="font-sans antialiased">
{{ yield:after_body }}
<div id="main" #dragover.prevent #drop.prevent>
<the-header
:transparent="Boolean({{ alternate_header }})"
{{ if show_notice }}
:notice="{text: '{{ notice | smartypants }}', target: '{{ notice_target }}', color: '{{ notice_color }}'}"
{{ /if }}
>
It is in a VUE project, that got compiled with laravel-mix and webpack.
I have /templates /layout /partials folders containing HTML like this.
Related
I would like to add <body><noscript><h1>Please enable your javascript<h1></noscript></body> in the developer mode.
I tried to configure it in the nuxt.config.js file but it didn't worked.
If you want to setup a noscript tag, you need to create an app.html in the root directory of your project as explained in the documentation.
Like this
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
<noscript>Your browser does not support JavaScript!</noscript>
{{ APP }}
</body>
</html>
Keep in mind that if you're using ssr: true, you will still get some content even if the JS is disabled because the content will be generated on the server for some parts.
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.
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>
The Nuxt docs say you can override the default document by...
creating an app.html file in the source directory of your project which by default is the root directory.
I did just that. I created the following app.html in my project root:
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
<script>alert('custom document');</script>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
{{ APP }}
</body>
</html>
Note the alert(), which is just to confirm it's using the custom document.
When I serve the project it continues to use the default document, however. The docs don't say you have to do anything else to enable the custom document, other than create the file.
What am I doing wrong?
Working perfectly fine on my side.
I'm using target: static and ssr: false (works with ssr: true too).
The issue should be coming from somewhere else. Like a middleware or alike.
I have a nuxt app, I'm trying to add GoogleTagManager noscript to <body>.
As far as I know, the only way to do so is to add a custom app.html, here is mine:
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=xxxx" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{{ APP }}
</body>
</html>
Now this works fine, however the innerHTML part, the <iframe></iframe> is escaped.
This is what I get when I inspect the element:
<body>
<noscript>
"<iframe src="https://www.googletagmanager.com/ns.html?id=xxxx" height="0" width="0" style="display:none;visibility:hidden"></iframe>"
</noscript>
.
.
.
</body>
How do I get rid of these double quotes ?
You shouldn't modify any generated html code in your Nuxt app. What you should do instead is create/use a plugin.
There is a GoogleTagManager wrapper plugin for Nuxt.js that you should use instead:
https://www.npmjs.com/package/#nuxtjs/google-tag-manager
Follow the instruction and you will be ready to go.
With Symfony 3, I'm using Assetic filters to process my .less files, and I simply want to know how to move them outside the /web directory, for example from /web/css to /app/Resources/less.
Indeed, in twig templates I don't know how to give the right location.
I'm using a basic Assetic config:
assetic:
debug: '%kernel.debug%'
use_controller: '%kernel.debug%'
filters:
cssrewrite: ~
less:
node: /usr/bin/node
node_paths: ['/usr/local/bin/node_modules']
Let's say I have this simple Less file, currently located at /web/css/test.less:
#color : orange;
body {
background-color : #color;
}
Then, if I want to generate the link to the processed stylesheet, I'm doing like this in an HTML template:
<!doctype html>
<html>
<head>
[ ... ]
{% stylesheets 'css/test.less' filter="less" output='css/test.css' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
</head>
<body> </body>
</html>
So, if I move /web/css/test.less to /app/Resources/less/test.less, what should I give instead the ##### below ?
{% stylesheets '#####' filter="less" output='css/test.css' %}
Have you tried this (2nd edit):
{% stylesheets '#Resources/*' filter="less" output='less/test.less' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
Then place your files under Resources like this:
Resources/less/test.less
Where Resources is the path 'src/AppBundle/Resources'.