Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: 'noindex' tag lost after minification #177

Open
ram108 opened this issue Oct 19, 2019 · 2 comments
Open

Bug: 'noindex' tag lost after minification #177

ram108 opened this issue Oct 19, 2019 · 2 comments

Comments

@ram108
Copy link

ram108 commented Oct 19, 2019

Tag totally despearing:

<!--noindex-->Don't index this text.<!--/noindex-->

See wiki: https://en.wikipedia.org/wiki/Noindex

@stklcode
Copy link
Contributor

stklcode commented Oct 19, 2019

Confirmed. Because the given notation technically is a comment and Cachify removes comments using a simple RegEx, it is removed from the markup.

cachify/inc/cachify.class.php

Lines 1241 to 1251 in a3d7597

$cleaned = preg_replace(
array(
'/<!--[^\[><](.*?)-->/s',
'#(?ix)(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:' . $ignore_regex . ')\b))*+)(?:<(?>' . $ignore_regex . ')\b|\z))#',
),
array(
'',
' ',
),
$data
);

The <noindex>Don't index this text.</noindex> notation is not affected.

Applies to a couple of other special-use comments as well. None of them really common though.

@chesio chesio changed the title Bug: Losting 'noindex' tag on minification Bug: 'noindex' tag lost after minification Oct 28, 2019
@Zodiac1978
Copy link
Member

So the solution could be to disable the minification completely.

What about making this an option and split it up? "Minify HTML" and "Remove comments"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants