Improvements to Relative URL Conversion Scope and Customization Flexibility
-
Hello,
I’m currently considering using the Minify HTML plugin’s relative URL conversion feature and would like to suggest some improvements for your consideration:(1) OGP Tag URLs
As noted in this Stack Overflow discussion (Open Graph cannot resolve relative URL), the OGP does not support relative URLs. Therefore, URLs within OGP tags should be excluded from the relative URL conversion process.ogc:url a rdfs:Datatype ;
https://ogp.me/ns/ogp.me.ttl
rdfs:label “URL”@en-US ;
rdfs:comment “A string of Unicode characters forming a valid URL having the http or https scheme.”@en-US ;(2) URLs in Comment Text
On my blog, URLs posted in comment text are automatically displayed as links. The current relative URL conversion process also modifies the anchor text of these links, resulting bad user experiences. Example:- Before conversion:
<a >https://blog.example.com/?p=123</a>
- Current result:
<a href="/?p=123">/?p=123</a>
- Desired result:
<a href="/?p=123">https://blog.example.com/?p=123</a>
Proposal:
I propose limiting the relative URL conversion to the following attributes:
href
,src
,srcset
,action
,value
Note: The
value
attribute is particularly useful for elements generated bywp_get_archives
, such as<option>
elements.Additionally, implementing
apply_filters()
for the final HTML output would enable users to make environment-specific adjustments, greatly improving the plugin’s versatility.Thank you for considering these suggestions. I look forward to your response.
- Before conversion:
- You must be logged in to reply to this topic.