samuelk Posted May 20, 2013 Share Posted May 20, 2013 Hi, Example, I am trying to print out a HTML comment in the generated HTML / TPL file. <!--googleoff: snippet--> abc123 <!--googleon: snippet--> But Smarty somehow truncates the comment. Purpose is to prevent Google from indexing some content on my page. Link to comment Share on other sites More sharing options...
vekia Posted May 20, 2013 Share Posted May 20, 2013 Hi, Example, I am trying to print out a HTML comment in the generated HTML / TPL file. <!--googleoff: snippet--> abc123 <!--googleon: snippet--> But Smarty somehow truncates the comment. Purpose is to prevent Google from indexing some content on my page. try with {literal} CODE HERE {/literal} tags im not sure, maybe this wont work. I think that the problem is somewhere else Link to comment Share on other sites More sharing options...
NemoPS Posted May 20, 2013 Share Posted May 20, 2013 TPLs support html comments usually, what do you get from that one? Link to comment Share on other sites More sharing options...
donorsi Posted October 20, 2014 Share Posted October 20, 2014 I have exactly the same issue. I can make any changes in the header.tpl and they show up just fine in the page source after i make the change (i have force compile On and Cache Off). However, if i add <!--googleoff: snippet--> abc123 <!--googleon: snippet--> it does not work. The comments are just removed, is like they don't exist in the header.tpl code. I also tried {literal}<!--googleoff: snippet-->{/literal} but it still does not show... Link to comment Share on other sites More sharing options...
donorsi Posted October 20, 2014 Share Posted October 20, 2014 Ok, i made some progress The issue is caused by "Compress HTML" option from Advanced settings > Performance. If that is set to ON, all html comments are stripped from <body> Does anyone knows how to avoid that? I assume some core files might be changed... i want to Compress HTML but keep the comments. Link to comment Share on other sites More sharing options...
NemoPS Posted October 22, 2014 Share Posted October 22, 2014 It's not easy if you don't know regex. You must edit tools\minify_html\minify_html.class You might be able to get away by just commenting out this // remove HTML comments (not containing IE conditional comments). $this->_html = preg_replace_callback( '/<!--([\\s\\S]*?)-->/' ,array($this, '_commentCB') ,$this->_html ,Media::getBackTrackLimit()); But I didn't test it Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now