Skip to main content

One less card for stoot

Auto-generated description: Text spelling stoot! is displayed diagonally on a pink background.

Stoot now has an option that will remove the Open Graph / Meta Tags card associated with the first link in a mastodon post. If you are interested in the tags that Mastodon sees, you can go to OpenGraph XYZ to put in your favorite URLs. Here a direct link to your fifth favorite. Mastodon takes the information meta tags from the first URL and makes them look nice when you post. For example, I posted a toot1 with a link to a post that created. I will get something like the following.

A post an arrow pointing to the URL and the second pointing to a card

Summary

You can now add a toot to your blog without including the Open Graph tag.

{{< stoot instance="$InstanceTLD" id="$ID" enableOGCard="true" >}}

The new enableOGCard option defaults to true so that it doesn’t unexpectedly change on people who have an older version of this plugin.

Details about the HTML and CSS structure

About a week ago, I got a message asking why stoot would render the image twice for the same mastodon toot.

Honestly, I had no idea it was doing this and haven’t looked at the code since I had packaged it up two weeks ago.

But, I didn’t want to leave this person without any help so I started to look into the issue and was able to reproduce the problem with a toot from someone I was already following.

Here is the code to embed it if you are using the stoot plugin

{{< stoot instance="writing.exchange" id="113300475439404467" >}}

A very pretty picture, but I don’t know if seeing it twice in succession.

For me to understand something better, I like to diagram it as I step through the code. I’ve included this diagram that shows you what div tags are created when using stoot. If you can always check out the code on GitHub.

All the different parts of a toot generated by stoot
Toot-block
This is the CSS class in the blockquote element that contains the entire mastodon post.
Toot-header
The div contains the information about the account that created the toot.
Toot-profile
This is the profile image of the account that made the toot. I included this CSS from the original project to establish a baseline for styling.
Toot-author
This is a div that contains the two links toot-author-name and toot-author-name that go to the same account page.
Toot-author-name
The name that toot author is going by at the time of rendering. The names sometimes changes as decided by the person in charge of the account.
Toot-author-handle
This is the account name in the @name@server format that mastodon likes to use.
Content
This is the main text of your toot.
Toot-img-grid
Stoot includes CSS and logic to handle 1, 2, 3, or 4 images in a grid and render them properly.
Toot-video-wrapper
Behind the scenes, there are two possible wrappers that render depending on what kind of video media is included with the toot.
Toot-card
This the div that contains the Open Graph card of the first link in the toot. This will include an image, title, and description from the website in the URL.
Toot-poll-wrapper
This is the div that containers HTML <meter> elements to convey the
Toot-footer
Contains date and time of the toot.

The problem is coming from the toot-card and I didn’t want to change all the cards, because someone might have become reliant on this behaviour or worse - never noticed it.

Further CSS Details

I didn’t want to make people work hard to style the included card, so I removed some styling from the CSS.

Show the different divs that make up the divs found in the Open Graph card

There are two div tags in the toot card that you can use to make things work to your satisfaction.

Controlling the Card

The problem is coming from the toot-card and I didn’t want to change all the cards, because someone might have become reliant on this behaviour or worse - never noticed it.

After idenifying the part of the code that controlled the cards, I set a conditional around it.

{{ if eq $enableOGCard "true"}}
{{ with $json.card }}
  {{- $cardData := . -}}
  {{- with $cardData.image -}}
  
  <a href="{{ $cardData.url }}" rel="'noopener">
    <div class="toot-card">
      <div class="toot-card-image">
        <img src="{{ $cardData.image }}" 
          alt="Card image from {{ $masIns }} toot {{ $id }}" 
          loading="lazy" class="toot-card-image-image" />
      </div>
      <div class="toot-card-content">
        <p class="card-title">{{ $cardData.title }}</p>
        <p class="card-description">{{ $cardData.description }}</p>
      </div>
    </div>
  </a> 
  {{- end -}}
{{ end }}
{{ end }}

At the top of the file, we have the following line that sets the value to a default in case it is isn’t specified.

{{ $enableOGCard := .Get "enableOGCard" | default "true" }}

What is next?

Time to close all the tabs and call it a night.

I would like to change the alt text for the incoming images, but I think I would have to learn more about what is offered from mastodon using this API.

I want to that @lmika for giving me some advice about the go programming language. I also want to thank @DaveyCraney for giving me some feedback about stoot.

And I want to thank you for making it to the end of this article.


  1. I am really hating the different names for slightly different things right now. ↩︎

Manny Monday Oct 28th, 2024

I talk a little bit about starting something new and then transition into the update to the stoot plug-in (or plugin, depending on how you spell it).

Music by LofCosmos from Pixabay.

Transcript

Manny Monday Oct 21st, 2024

Just wanted to make a little something.

Music by LofCosmos from Pixabay

Feel free to contact me with any feedback!… Well, almost any feedback.

Transcript

A List Of Text-Only & Minimalist News Sites - GreyCoder

There is a _lot_ of content out there. Some of it's news, some of it is propaganda. I hope that this helps you get to whatever you want to read faster.

Text-only websites are quite useful, especially today, because web pages are increasingly filled with ads, videos, and bandwidth-heavy content.

Found via Neblib

🍿 The Retirement Plan (2023) - β˜…β˜…β˜†β˜†β˜†

The Retirement Plan poster

If you have seen the trailer, then you have seen the movie.

It was late at night, we wanted to watch something lite. Seeing Nicolas Cage and his stunt double mow through unremarkable opponents was just the thing we needed.

Description from The Movie Database

When Ashley and her young daughter Sarah get caught up in a criminal enterprise that puts their lives at risk, she turns to the only person who can help: her estranged father Matt, currently living the life of a retired beach bum in the Cayman Islands. Their reunion is fleeting as they are soon tracked down on the island by crime boss Donnie and his lieutenant Bobo.

Here is a link to The Retirement Plan trailer.

Template uses lantern by Robb Knight

Dungeons & Dragons taught me how to write alt text – Eric Bailey

If you are not familiar with Dungeons & Dragons, there are two general flavors for how to play:
  1. Using miniatures and a map, or
  2. Theater of the mind.

This reminded me of all the times that I would play with my daughter when she was little.

Thoughts about the newest iPhone

Two weeks ago, my wife told me that we should start looking for new phones for our daughters because they have been having performance problems for the last couple of months. They are both using a 6th generation iPhone and seeing limits with battery life and a couple inconvenient os incompatibilities. My wife said that we should buy a new phone for ourselves and hand down our iPhone SEs to them.

So I was really excited about what this Apple event was going to bring.

And I am excited about the upcoming camera control button and I’m excited about just moving up from what I previously had. I understand that just because it’s a new phone and it’s a year over a year change it’s not always going to be exciting.

But, this release feels kind of weird it feels almost as if there wasn’t a lot there.

I think the problem is that with the upcoming release. There’s a lot of things that are being promised by Apple Intelligence. Which is something that I don’t really want.

I feel that ultimately we are moving towards a product that I am no longer the target audience for. And there’s nothing wrong with that; not every product is going to be made for me.

The uneasiness that I feel is that I no longer know what that product is going to be.

Am I being materialistic in hopes that some magical tool will made? Or, am I sad that they don’t make them like that anymore?

πŸ“Ί KAOS (2024) - β˜…β˜…β˜…β˜…β˜…

I didn't know that I was going to enjoy this as much as I did.

This show harkens back to the old school gods. The fickle ones that would smite you down because of a petty slight or demand that you kill your children because the will it so.

A long way from Disney’s Hercules. There is murder (patricide, infanticide, and everything in between), sex (quite a bit), and just a whole lot of creepiness.

Honestly, I didn’t think that I would like it but I found myself caught up in the execution of the story.

I think this is definitely a show for anyone who is a fan of Jeff Goldblum. I haven’t seen all of his movies, but he certainly knows how to show someone slowly crumbling under paranoid. It’s how I imagine minions working under some comic book villain; it’s not a matter of if but when he’s going to kill you.

And that’s part of it all.

Zeus comes from a horrible upbringing, and in a lot of ways, it’s stuck with him and as the King of the Gods no-one has been able to tell him no. Not a recipe for good mental health.

The other actors round out the cast pretty well but there are quite a few times where it felt that things happened because the plot dictates it.

I don’t think we’re going to see another season of this, but I’m so happy that we got this one.

Deadpool & Wolverine poster

Overview

As discord reigns on Mount Olympus and almighty Zeus spirals into paranoia, three mortals are destined to reshape the future of humankind.

50 Ideas for Blog Posts by Lou Plummer #21

I don't do a lot of hobbies like I used to.

  1. What kind of adventures have you had pursuing your hobbies?

I think the closest thing I have in terms of adventures related to hobbies is trying to find hotels or things along the way when we are going on vacation.

You don’t really know what you are going to get as far as quality along the way and driving in America has become more and more… um… aggressive as people speed by in order to get there just 2 minutes faster so that they can wait at the next light or traffic congestion.

🍿 Deadpool & Wolverine (2024) - β˜…β˜…β˜…β˜…β˜†

Me sitting on a movie display for Deadpool and Wolverine

This movie allowed me to laugh with my friends.

I think that’s my favorite part of this movie. Just being able to sit back and have fun with it. I’ve never really considered Deadpool a serious character and honestly didn’t have a lot of expectations going into this.

If you’re familiar with Marvel movies and crude humor, than this is the movie for you.

It’s certainly the movie for me and wouldn’t mind watching it again with my friends.

Deadpool & Wolverine poster

Overview

A listless Wade Wilson toils away in civilian life with his days as the morally flexible mercenary, Deadpool, behind him. But when his homeworld faces an existential threat, Wade must reluctantly suit-up again with an even more reluctant Wolverine.