API - Return the existing markups to remove
phbernard opened this issue · 1 comments
Currently, API clients, such as rfg-api, usually inject the generated HTML markups in existing pages. When this happen, they may need to remove existing markups. For example, a favicon.ico
is already declared, and this markup becomes irrelevant because of the new one provided by RFG.
However, it's not easy. the HTML returned by RFG is too raw for a client to understand what it should really keep or remove. As of today, the options for a client are:
- Remove a fixed set of know markups (eg. "always remove
link
withrel
=shortcut icon
"). Problems: this puts favicon logic in clients. Better keep it in RFG itself. Plus the client might remove too much markups (example). - Parse the HTML returned by RFG to guess what should be removed. But this is not reliable. For example, when a client realizes RFG returns
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
, should it remove alllink
markups? Onlylink
markups withrel
=icon
? Onlylink
markups withrel
=icon
andtype
=image/png
? Onlylink
markups withrel
=icon
andtype
=image/png
andsize
=16x16
?
The API should return a section which contains a list of markups to remove, with a CSS selector syntax (eg. link[rel="icon"]
). For example, see the defaultRemove variable.
With this feature, there would be no more "remove og:image
or not" issue. RFG would tell what should be done on a per-request basis.
Implemented and deployed a minute ago.
See https://realfavicongenerator.net/api/interactive_api#overlapping_markups