Microblog

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.

Plumage glass.photo/pratik/3UFkV2LUQ1w

Image 113300475290024282 from toot 113300475439404467 on writing.exchange

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. ↩︎

Categories:

Stoot has been added to the list of official plugins for micro.blog! It’s also had it’s first change which should address some issues with sizing!

Categories:

Introducing stoot for Micro.blog

Stoot example.

I’m on mastodon too much a lot a fair amount of time and come across items that I want to share with others on my blog. stoot is a Hugo shortcode that allows you to have a static version of a mastodon post on your site. This can match your template or be restyled as you choose.

Why?

As of this writing, I don’t use anything specifically to store links. I attempted to save things to Apple Notes and Drafts and this gives me the URL.

Apple Sharesheet saving URL to a new draft in the Drafts Application

The example that I’ll be using for this post will be to https://social.lol/​@mandaris/112944060166510117.

This works for storing the information for general notes and references, but still leaves the sharing of the content unfinished. In a lot of my previous posts, I would just have a link to a post. This is acceptable, but I’d like to make it convenient for my readers (a.k.a me) to get all the content in one place instead of going back and forth.

I remembered that Hugo offers shortcodes that allow you to embed a tweet, youtube video, etc. into a post and did a search for that. Unfortunately, I couldn’t find one for mastodon. When looking at the one for twitter, I see that it is essentially adding the code that is provided when you embed the iframe1 that twitter supplies. I suspect that it’s because mastodon also has an iframe that it’s not necessary.

The embed pretty small easy to read compared to the code that is loaded for a twitter embed.

Using the URL above, we can see what is created by mastodon. I added spacing for legibility.

<iframe
  src="https://social.lol/@mandaris/112944060166510117/embed"
  class="mastodon-embed"
  style="max-width: 100%; border: 0" width="400"
  allowfullscreen="allowfullscreen">
</iframe>

<script 
  src="https://social.lol/embed.js"
  async="async">
</script>

This produces the following output.

It look alright, but I found that it would cut off the bottom of longer posts and the scroll bars wouldn’t consistently show up. It looks like the embed.js is adding overflow: hidden to the styling during rendering and it can effect embeds with text. I’ve included a picture below in case this is fixed by browsers or changes in the code in the future

Mastodon post embedded in a web page that shows text being cut off.
I had more to say!

I could add the following css to force the embed to expand as needed, but that’s one of those solutions that you find out after working on something else.

.mastodon-embed {
  overflow-y: auto !important;
}

Full stop, this is where I should have stopped but I’ve already invested the time to make this shortcode.

How?

This is a Hugo shortcode that will allow you to embed a mastodon post into your blog. It places the post or toot in the document as a <blockquote> and is still pretty legible my RSS reader. It’s 100% based off of this post by Bryce Wray. I think that you can find updates from the original author by looking at the git repository for his site.

I’m not a Go expert like Leon, who could give you a wonderful breakdown of the code. :) Suffice to say, if you’ve got a background in code you can figure it out.

My goal is to pull the specific code out so that I can use it on Micro.blog as a plugin for myself and others. So, I pulled out the shortcode and an associated css file and placed it in a different repository.

stoot plugin on GitHub

Again, I didn’t change any of the code found in the css file and you may look at it and wonder where --text-base and --social-sans-serif are defined. Those are in Bryce’s hugo-site repository under assets/css/partial/__050-global.css. I thought about just adding them to this repository, but I wanted to get some feedback from users and I saw that it seems to work without it.

I tested the plugin with a couple other Micro.blog themes such as Sumo, tiny, cards, and Tufte and it seemed to work well. Although, Tufte did have the images show up larger than I would have liked. You can use custom css to make changes as desired.

Usage and comparison examples

The shortcode format looks like the following.

{{< stoot instance="$InstanceTLD" id="$Id" >}}

PLEASE NOTE: I had to remove the brace on either side because of it wasn’t attempting to process the shortcode in the code block above. I tried using %lbrace; but it doesn’t replace it properly. FIXED: Changed the block to be markdown and putting a comments /* */ around the contents worked.

Below, you’ll find the mastodon embeds and then stoot renderings. As of this moment, stoot does not do anything with the text of posts that are marked as sensitive. I’ve removed the call the the javascript after every embed to reduce repeated calls2.

Regular ole toot

Working on another technical project. It’s looking like it’s going to get more complicated than I expected. Part of me is excited and part of me dreads having to hunt down unexpected issues.

This is a toot with an image

I think I might give this a try.

Image 112878275931064198 from toot 112878275954894008 on social.lol

This is a toot with multiple images

Another post with multiple images.

Image 112962303425778240 from toot 112962304543748930 on social.lol Image 112962303502420039 from toot 112962304543748930 on social.lol Image 112962303545024636 from toot 112962304543748930 on social.lol Image 112962303550922135 from toot 112962304543748930 on social.lol

This is something with a content warning.

Notice the difference in what is displayed by both.

I'm trying something with a content warning.

This is a toot with content warning on the images.

Multiple images with sensitive content

Image 112962342032467150 from toot 112962351533984937 on social.lol
Sensitive content
(flagged at origin)
Image 112962342033758096 from toot 112962351533984937 on social.lol
Sensitive content
(flagged at origin)
Image 112962342039351201 from toot 112962351533984937 on social.lol
Sensitive content
(flagged at origin)
Image 112962342040977991 from toot 112962351533984937 on social.lol
Sensitive content
(flagged at origin)

This is a poll

Test poll. Toppings on pizza.

85.7%
Yes
14.3%
No

Considerations for the future

After working on this, there are somethings I’d like to think about in the future.

1. What changes would I like to implement?

This plugin uses different style choices. It fits perfectly into Bryce’s site because it was made by and for him. I’m essentially taking what he’s done and shoved it into my page.

This is on me to change using the custom css option offered by Micro.blog.

2. Another shortcode?

During testing, I realized that I’ve added a fair amount of shortcodes in my writing. Hugo doesn’t handle this well and makes transitioning between different themes troublesome.

I’m playing with the idea of creating a Micro.blog plugin that contains all the shortcodes that I’ve seen. I’ve thought about this everytime that I look at the Tufte theme, but I’d have to see how much bandwidth I have in September

Feedback

As always, I love getting feedback on any of this.


  1. The <iframe> HTML element represents a nested browsing context, embedding another HTML page into the current one. -Mozilla documentation ↩︎

  2. I’m not an expert in javascript and don’t know if browsers are smart enough only call the script once. ↩︎

Categories:

Micro Camp 2024 This Year More Micro

Micro Camp sticker that looks like a log fire with Micro.blog logo flames.

I am pretty excited by the upcoming mini conference for Micro.blog and the IndieWeb.

Jean has posted the schedule for this year and we even have a guest speaker!

Here is the schedule for Friday, May 17. (All times are Pacific.) Details on the chat channel and door prizes to come! Follow [@camp](https://micro.blog/camp) for updates. 🏕️

  • 11:45 Welcome to Micro Camp and overview of the schedule
  • 12:00 Conversation about blogging and social media with Christina Warren (find her on Mastodon and Bluesky)
  • 1:30 State of the Micro.blog with Manton, Jean, and Vincent; Q&A
  • 3:00 Community happy hour on Zoom and announcement of door prize winners

Unfortunately, I might not be able to attend this year as I’m supposed to be in the office and it lands on the end of a sprint.

Categories:

RE: On Micro.blog, Scribbles, And Multi-homing by Leon Mika

I’ve recently read this article by Leon Mika on his MicroBlog. It goes a little bit into the details of where he wants his writing to go. I’ve met people through the Micro.blog and it is notable when I see them post about other blog services that they are trying out.

Profile of Leon MikaI’ve been ask why I’m using Scribbles given that I’m here on Micro.blog. Honestly I wish I could say I’ve got a great answer.

Leon starts his piece with honesty and follows it with thoughtful reasons.

I’ve also wondered why others are exploring the multiple solutions to building and maintaining a blog. After having years where there were only a couple of solutions, I don’t fault anyone for wanting to explore and see different options.

Having different blogs to express different aspects of your personality and interest does make sense. And, Leon makes it clear that he’s prioritizing his most important reader, himself. On this point, I really applaud him.

Categories:

Why does the Labarum theme not have a header

If you’ve come to my site, you’ve seen it. Or rather, seen that it isn’t there. Most site have them, whether it’s a big banner or image that lets you know that you are on a webpage. I’m referring to the header; usually the first h1 element in the html. Open any book on HTML and it’s one of the top five elements that you learn about.

But, if this element is so basic and used so often, then how why do I not use this in my theme?

No guarantee on structure

There are different tools that you can use to write posts for micro.blog. You can post from the website, MarsEdit, Ulysses, drafts, etc. These tools usually allow the end user to write in some form of Markdown syntax. If you look up the syntax for Markdown on Markdown Guide Basics Syntax or on the DaringFireball Markdown Basics page, you will see that the first thing they point out is the # used to make a heading. The tools will use the convention of taking the first # header and using it as the title for a post.

Most of the websites that I’ve come across will use title of a post as an h2 in order to denote that its semantically lower than the h1 they would have in the header of the page.

But, what about posts without a title? What about the person who isn’t familiar or not thinking about these details as they type away on their keyboards on that great post that will finally prove that whether pancakes or waffles are the superior breakfast item1.

Other than testing whether the content has a title, the theme does not make any adjustments. It can’t automatically change all the headers and assume that the writer meant ### instead of ## for the sub-header.

Also, If we only navigate by headers and headers are only on titled posts, then what about the micro posts that micro.blog uses?

I’m not an accessibility expert, I just hope that whoever is using the theme, will be able to navigate using the different articles and aria-labels. I really hope that not having the headers isn’t a deterrent from reading the site. If you know of someone, please send me their information so that I can improve this site.

What would it take to change?

I was thinking about changing the structure of the theme to match the convention that I had seen with other themes. I’d make the articles have h2 and just go through all my posts to make sure everything had the proper heading.

In my local testing, I found that I ran into another problem where the built in table of contents feature of Hugo defaults to using h2 and h3 tags to create its content.

It’s documented on how to change the start and end levels but this would mean that users of the theme would see a change after an update. I can’t count on them reading the readme, being able to test it before hand, or going back to a previous version.

Ten Times the Technical Transform

About a month ago, I asked @help how many people were using this theme. Manton said 10.

I was shocked!

That’s 9 more than I was expecting.

I hope these people are happy with the theme - or so I imagine - and I don’t want to change that.

Withdrawn on the World Wide Web

The last reason is more personal.

I’m on the web, but I would rather you start reading what I wrote than read about me. Based off of my own web-surfing habits and the site traffic I get, I assume that when someone comes to the site they are coming from a direct link to an article. If that is the case, I want you to get to reading as quickly as possible.

The website has a title that is read by accessibility readers and shows up in the tab of your browser.

I don’t know how much of my traffic is people new to the site, but I do have an about me at the bottom of the page. It’s kind of a “find out more from this author” that you would see in the back of a book.

For me, this is more comfortable because I have trouble writing about myself. Ask anyone who has written a resumé, and they might say its easier to express how you think of feel about different things than it is to write about how you are really good at TPS reports.

Let’s head this off

This is not an attack on sites that use h1 for the title and have it at the top. I love those sites and the people that make them. This is just me explaining the theories of my own site. It’s not conventional and sometimes I look at it and want to start over.

It’s because of that burning feeling, I continue working on it.

Just running forward.

Without a head.


  1. It’s pancakes. ↩︎

Categories:

Spent some time fiddling with code that I said that I wasn’t going to touch. Very satisfying as I see the pile of work piling up in the distance.

Categories:

The 100

For years, I would hear people say that it takes 100 days to develop a new habit. I didn’t set out to do that. I wanted to write on a more regular basis and just started writing on November 1st of last year. I was determined to write something every day and post it.

What was the experience?

Sometimes it was actually pretty stressful coming up with something to write about. Some days were just one-liners that I would have just tweeted. Sometimes Many times, it was a picture of my dog; who I think deserves her own blog.

What if I annoy people who were reading my site and they go away? Well, I didn’t have that many readers anyway, and my pieces are typically very short.

The benefit of being semi-anonymous was that I honestly couldn’t tell if people liked it or not. It was kind of freeing and let me think about how I was writing.

I started exploring more into what it means to be the first audience for my writing. That doesn’t mean that I spent a lot of time agonizing over making things perfect, but it did mean that there were a couple of posts that took more time to write.

What’s next?

I plan on stopping the daily post for a couple of days and working through some of my post ideas that I’ve been putting into Drafts. The more ideas you capture, the more ideas you make.

I also want to start highlighting some post from other people on the internet. I love the web when it connects us with cool ideas.

Categories:

New version of Hugo offered with Micro.blog

Added Hugo version 0.117 as an option on the Design page for your blog.

I've been seeing differences between my current home setup and what's on Micro.blog and always attributed it to some difference in my environment and what is on the server. Some kind of secret sauce.

Unfortunately, it looks like something changed in the way that Hugo (or maybe goldmark) handles code blocks.

Code blocks in newer version of hugo

I’ve got it running on my test blog and have a post that I can refer to so that I can tweak the CSS to go with this newer version.

Table and Gist

Still, I’m excited because this release has a lot of cool things since the v.91 that I’ve been targeting. Such as…

92 Removes depreciated .Page methods

93
Markdown diagrams and code block render hooks

94
20% reduction in build time and memory usage

99
Error handling release

101
Gif image processing

103
Updates to 404 support

104
$image.Colors

107
Update to code highlighting

108
Change to the render hook so that you can have it make it so that stand alone images are placed in a

tag. When I look at my blog, I see that you have something there to handle this behavior.

You can checkout the release notes here: github.com/gohugoio/…

Categories:

What deserves to be shared

I’m self aware enough to know that some of what drives me to write on this blog is to communicate and share my thoughts and feelings on various things. Some would call it a little narcissistic.

That being said, I do come across things that I would like to share. For instance, I came across a post by my friend Adam on Mastodon and I want to put it on my blog. I sometimes wouldn’t know how I should go about doing that. Should I just put the link into Micro.blog? Apple Notes? What about a third party application?

I took a step back and remembered that I had put sometime into saving bookmarks into drafts1.

I took a fair amount of time reading over the IndieWeb during the creation of the labarum theme but I’m still having trouble getting it absolutely “correct” because some of the examples that they point to for replies, likes, and articles are returning 404 pages.

Still, I’m pretty confident in the site as it stands and will continue to use the Microformats Parser as part of the process.

My current Web Capture Template will be the following until I get some time to rethink things.

# [[title]]

<blockquote>
[[selection_html]]

<footer>
<cite>
    <a class="u-in-reply-to" rel="in-reply-to" href="[[url]]">
        [[title]]
    </a>
</cite>
</footer>

</blockquote>

<p class="p-summary">Begin response here</p>

I’m planning on making it so that I can select some text and get the draft ready to send to my blog. Otherwise, I’d just send the link directly to someone2 who is interested it.

I think the second hardest part was getting it to stop making the smart quotes.

We solved the “how” but now “what”

This will be an ongoing question. Everyone’s blog is a personal platform and when we put something on it, we are broadcasting a little bit of who we are.

With the recent turmoil of what used to be twitter and reddit, I feel that user created content needs more avenues for discovery.

People used to call it the social graph.

As my site is a node in the social graph, I’m going to post more stuff that interests me.

Sure, you are going to see repeats from other places, but that’s ok.


  1. Drafts does have a tag line that it’s where text starts. ↩︎

  2. This is usually via text message to my family and friends or to my favorite discord. ↩︎

Categories: