Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB

  1. Home
  2. General Discussion
  3. How to go block-less with the WordPress ActivityPub plugin

How to go block-less with the WordPress ActivityPub plugin

Scheduled Pinned Locked Moved General Discussion
activitypubblocksperformancewebpagedownloadwordpress
12 Posts 6 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • frank@blog.futtta.beF frank@blog.futtta.be

    Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

    For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.js, i18n.min.js, url.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

    To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

    Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

    Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class. With quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looks pretty nice (and similar to the JavaScript-rendered one).

    If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

    edent@mastodon.socialE This user is from outside of this forum
    edent@mastodon.socialE This user is from outside of this forum
    edent@mastodon.social
    wrote last edited by
    #3

    @frank @pfefferle

    I have a blockless theme. There are a bunch of things which I deactivate.

    See https://gitlab.com/edent/blog-theme/-/blob/master/includes/remove.php?ref_type=heads#L127

    I don't have reactions though. I keep going back and forth about whether I want them and whether it is possible to back-fill them.

    pfefferle@mastodon.socialP frank@blog.futtta.beF 2 Replies Last reply
    0
    • pfefferle@mastodon.socialP pfefferle@mastodon.social

      @frank awesome! would you maybe like to contribute this to the plugin? I am thinking about a snippets "directory", to show how the plugin can be extended with special features!?

      I will create a barebone folder with a readme for that!?

      frank@blog.futtta.beF This user is from outside of this forum
      frank@blog.futtta.beF This user is from outside of this forum
      frank@blog.futtta.be
      wrote last edited by
      #4

      @pfefferle sure, will be happy to contribute this 🙂

      1 Reply Last reply
      0
      • edent@mastodon.socialE edent@mastodon.social

        @frank @pfefferle

        I have a blockless theme. There are a bunch of things which I deactivate.

        See https://gitlab.com/edent/blog-theme/-/blob/master/includes/remove.php?ref_type=heads#L127

        I don't have reactions though. I keep going back and forth about whether I want them and whether it is possible to back-fill them.

        pfefferle@mastodon.socialP This user is from outside of this forum
        pfefferle@mastodon.socialP This user is from outside of this forum
        pfefferle@mastodon.social
        wrote last edited by
        #5

        @Edent @frank that looks way nicer than our current "static" implementation in the Webmentions plugin btw.

        what do you think: https://github.com/Automattic/wordpress-activitypub/pull/2909

        1 Reply Last reply
        0
        • edent@mastodon.socialE edent@mastodon.social

          @frank @pfefferle

          I have a blockless theme. There are a bunch of things which I deactivate.

          See https://gitlab.com/edent/blog-theme/-/blob/master/includes/remove.php?ref_type=heads#L127

          I don't have reactions though. I keep going back and forth about whether I want them and whether it is possible to back-fill them.

          frank@blog.futtta.beF This user is from outside of this forum
          frank@blog.futtta.beF This user is from outside of this forum
          frank@blog.futtta.be
          wrote last edited by
          #6

          @Edent You’re removing a lot as well, good job 🙂 What do you mean with “possible to back-fill them” Terence?

          edent@mastodon.socialE 1 Reply Last reply
          0
          • frank@blog.futtta.beF frank@blog.futtta.be

            @Edent You’re removing a lot as well, good job 🙂 What do you mean with “possible to back-fill them” Terence?

            edent@mastodon.socialE This user is from outside of this forum
            edent@mastodon.socialE This user is from outside of this forum
            edent@mastodon.social
            wrote last edited by
            #7

            @frank
            As I understand it, likes and reposts are sent as comments. I've deleted / rejected all of those comments.
            How do I get back the likes and reposts of old posts?

            I guess I could look at the posts and manually grab the ⭐ and ♻️ - but I wonder if there's an automated way.

            frank@blog.futtta.beF 1 Reply Last reply
            0
            • edent@mastodon.socialE edent@mastodon.social

              @frank
              As I understand it, likes and reposts are sent as comments. I've deleted / rejected all of those comments.
              How do I get back the likes and reposts of old posts?

              I guess I could look at the posts and manually grab the ⭐ and ♻️ - but I wonder if there's an automated way.

              frank@blog.futtta.beF This user is from outside of this forum
              frank@blog.futtta.beF This user is from outside of this forum
              frank@blog.futtta.be
              wrote last edited by
              #8

              @Edent I guess that if you deleted them, there’s no automated way to get them back?

              1 Reply Last reply
              0
              • frank@blog.futtta.beF frank@blog.futtta.be

                Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

                For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.js, i18n.min.js, url.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

                To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

                Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

                Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class. With quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looks pretty nice (and similar to the JavaScript-rendered one).

                If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

                quentin_ld@mastodon.socialQ This user is from outside of this forum
                quentin_ld@mastodon.socialQ This user is from outside of this forum
                quentin_ld@mastodon.social
                wrote last edited by
                #9

                @frank @pfefferle Great ! Nice Frank

                1 Reply Last reply
                0
                • frank@blog.futtta.beF frank@blog.futtta.be

                  Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

                  For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.js, i18n.min.js, url.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

                  To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

                  Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

                  Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class. With quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looks pretty nice (and similar to the JavaScript-rendered one).

                  If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

                  melroy@mastodon.melroy.orgM This user is from outside of this forum
                  melroy@mastodon.melroy.orgM This user is from outside of this forum
                  melroy@mastodon.melroy.org
                  wrote last edited by
                  #10

                  @pfefferle @frank I migrated away from WordPress luckily. And I just moved to Hugo. No regrets.

                  frank@blog.futtta.beF 1 Reply Last reply
                  0
                  • melroy@mastodon.melroy.orgM melroy@mastodon.melroy.org

                    @pfefferle @frank I migrated away from WordPress luckily. And I just moved to Hugo. No regrets.

                    frank@blog.futtta.beF This user is from outside of this forum
                    frank@blog.futtta.beF This user is from outside of this forum
                    frank@blog.futtta.be
                    wrote last edited by
                    #11

                    @melroy I still like WordPress, but to each their own Melroy 😉

                    1 Reply Last reply
                    0
                    • frank@blog.futtta.beF frank@blog.futtta.be

                      Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

                      For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.js, i18n.min.js, url.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

                      To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

                      Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

                      Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class. With quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looks pretty nice (and similar to the JavaScript-rendered one).

                      If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

                      futtta@mastodon.socialF This user is from outside of this forum
                      futtta@mastodon.socialF This user is from outside of this forum
                      futtta@mastodon.social
                      wrote last edited by
                      #12

                      @frank this has now been cleaned up and added as one of the snippets that are available in the @activitypub.blog plugin by @pfefferle , see https://github.com/Automattic/wordpress-activitypub/tree/trunk/snippets/blockless-activitypub

                      1 Reply Last reply
                      0
                      • tag-activitypub@relay.fedi.buzzT tag-activitypub@relay.fedi.buzz shared this topic

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      Powered by NodeBB Contributors
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups