Message Boards

Output the code without single line and with standard formatting

Marcin Klinski, modified 3 Years ago.

Output the code without single line and with standard formatting

New Member Posts: 12 Join Date: 1/3/20 Recent Posts
Hello,
I need to check WCAG 2.1 errors on page but if I read the URL by online tool PowerMapper (and also another tools) there are some wrong code (empty <title> in <body> and not in <head>).
But if we check the code by the browser there are everything ok (<title> tag is not empty and it is in <head>) .
Can we output the code without single line and with standard formatting ?
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Output the code without single line and with standard formatting

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
You can use ?strip=false to disable the relevant filter.
Marcin Klinski, modified 3 Years ago.

RE: Output the code without single line and with standard formatting

New Member Posts: 12 Join Date: 1/3/20 Recent Posts
Thanks, now I see the code without single line but the online validator still download different code, thats unsual ...
Online walidator gets that code:



<title></title>

<div id="yui3-css-stamp" style="visibility: hidden !important; position: absolute !important;"></div>

<title>
Welcome
</title>
But browser generate code correctly:
   <title>Welcome</title>
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Output the code without single line and with standard formatting

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
I can only guess here. Do you have a custom theme? Maybe it reacts badly to some header? Could you try with the standard theme?
You can disable the stripfilter altogether in Liferay. Could you try that and recheck again, maybe the filter breaks something. You can do that by adding the following line to portal-ext.properties
com.liferay.portal.servlet.filters.strip.StripFilter=false
For me, this looks a bit like "autocorrected" html, when a tag is missing, sometimes tools "correct" the html by adding the missing closing (or opening) tags somewhere. And by doing that, they introduce other issues.
Marcin Klinski, modified 3 Years ago.

RE: Output the code without single line and with standard formatting

New Member Posts: 12 Join Date: 1/3/20 Recent Posts
Christoph, thanks for reply.
The output HTML code is W3C correct so all <div> etc should be closed correctly. I also make changes with portal-ext.properties but that not help - the code is now without oneline but i see that at the beggining there are some multiple spaces / new lines / tabs etc.
I noticed that YUI script adding wrong code at the top and we have after DOM:



<div id="yui3-css-stamp" style="visibility: hidden !important; position: absolute !important;"></div>

<title>Welcome</title>

I found some info here about that problem https://github.com/liferay/yui3/pull/21
But after all I just add some jQuery code to remove yui3-css-stamp div $("#yui3-css-stamp").remove(); and now PowerMapper works !