Closed cybeardjm closed 2 months ago
@cybeardjm It does make sense to limit loading the JS/CSS only when an embed is on the page, good call.
The tricky part here is that you can really embed a post on any page, not just a post/page. For example, here's a tag page on my website, which shows the tag description, and could easily include an embedded post.
I am going to need to look into the performance trade-offs in terms of necessary database queries.
In the meantime, I checked one of your sites and I do see the JS loaded in the footer, as it should, since I am registering the script to be in the footer. Plus, I am also using the defer script tag attribute, so the impact should really be minimal.
As for the CSS file, including it outside of the head
element is not really commonly done, see:
Been playing with various cache plugins (with gzip + other defer/swap techniques) and speed-testing platforms, this is why I've suggested this, as these CS/JS appear in most "complaints"... If it's possible, would be a "+".
Sure, that makes sense.
On a side note, I will add that the plugin still provides a huge performance boost compared to the default embed method, at least for Mastodon.
Either way, I'll definitely look into this some more. Thank you for bringing this up!
Was thinking: loading on individual posts (even if no fedi embedded content) is probably not a huge problem, but at least the plugin should offer the option to deactivate (or not) for pages (including) via a checkbox in the settings.
FYI: https://www.didiermary.fr/wp-content/plugins/fediverse-embeds/dist/css/styles-bs.min.css 32.3 KB - 300 ms
DJM
On Sat, Nov 25, 2023 at 11:12 PM Stefan Bohacek @.***> wrote:
Sure, that makes sense.
On a side note, I will add that the plugin still provides a huge performance boost https://stefanbohacek.com/project/wordpress-plugin-for-fediverse-embeds/#performance compared to the default embed method, at least for Mastodon.
Either way, I'll definitely look into this some more. Thank you for bringing this up!
— Reply to this email directly, view it on GitHub https://github.com/stefanbohacek/fediverse-embeds-wordpress-plugin/issues/25#issuecomment-1826430547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMQ4RP5NVOSVSQRAW33YCD3YGJUMZAVCNFSM6AAAAAA7YH6GZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGQZTANJUG4 . You are receiving this because you were mentioned.Message ID: <stefanbohacek/fediverse-embeds-wordpress-plugin/issues/25/1826430547@ github.com>
@cybeardjm Yes, adding an option to customize the behavior and let the user decide makes a lot of sense. Thank you for the suggestion!
Hi, Just noticed that the plugin's library & CSS are loaded on everywhere on the site...
in the header. Would it be possible to: