Hello!
Can I check element existence with HTMLRewriter or any other method, but without regex?
My problem is simple - if I don’t have
<meta name="description">
on page - generate it.
How I can resolve this?
Hello!
Can I check element existence with HTMLRewriter or any other method, but without regex?
My problem is simple - if I don’t have
<meta name="description">
on page - generate it.
How I can resolve this?
It would not seem as if you could use HTMLRewriter for that, as that will only fire when an element is found. Of course you could run it and set a found flag when the element in question is found, however this is where its asynchronous nature will be an issue for you. You wont be able to know when it has finished and hence you wont be able to check that flag either.
In short, a plain pattern matching will be most likely the most feasible approach.