this post was submitted on 11 Apr 2025
78 points (98.8% liked)

Fediverse

32857 readers
443 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to [email protected]!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration)

founded 2 years ago
MODERATORS
 
Lemmydocs 7:4 – Thou shall create a blog

Features

  • Linked to a user using Lemmy’s API, no authentication
  • Host content on any instance
  • Category filters: Set one or more community as the categories
  • Easy to adapt to your profile
  • One page constraint
  • Anchor navigation and permalinks
  • Responsive
  • Dark / Light mode
  • No cookies or tracking
  • Interactive “about me”
  • No backend: serving a single lightweight page that can be hosted anywhere, including GitHub
  • HTML, CSS and ES6 JavaScript. That's it.

TODO

  • Possible compatibility issues with older iOS devices. Let me know if you encounter an issue! I'll be cleaning up the code in the meantime.
  • The only class not written by me is the markdown-html translation layer for which I'm using snarkdown. It does so using regex queries. As to not completely re-invent the wheel I've forked it for this purpose, but I'd like to write one myself.

GitHub | ./Martijn.sh > Blog

top 19 comments
sorted by: hot top controversial new old
[–] [email protected] 7 points 1 week ago (1 children)

This is pretty cool. Thanks for sharing!

[–] [email protected] 2 points 1 week ago

I'm glad you liked it, thanks for the kind words!

[–] [email protected] 6 points 1 week ago (1 children)

Why not just use an actual federated blogging service like write freely?

[–] [email protected] 9 points 1 week ago (1 children)

That requires the running and maintenance of a federated instance, which is not easy or cheap. Doing it like this allows anyone to make a BlogOnLemmy by serving but a single webpage, no extra server cost at all.

[–] [email protected] 0 points 1 week ago (1 children)

So, schlepping it off on other instance owners, so they host it, which as you say is not easy or cheap.

[–] [email protected] 3 points 1 week ago

The open web and API's are designed for this purpose, and don't think any instance would ever follow reddit and close up theirs.

I'm all for donating to your instance owner, altough I'd be surprised if any would mind their API being used this way. Giving credit where credit is due.

[–] [email protected] 5 points 1 week ago (1 children)

I was just thinking about this this morning as we will be going on a 6 week roadrip around NZ and I cant be bothered to stand up my wordpress server again

[–] [email protected] 3 points 1 week ago

Feel free to use the code in any way you like, and enjoy your trip!

[–] [email protected] 4 points 1 week ago (3 children)

I’m a little lost. You mention hosting content on any instance, or on GitHub. How does that work? And if your content is elsewhere what is Lemmy doing? Authx?

[–] [email protected] 10 points 1 week ago (2 children)

A lot of static site blog generators use markdown to create posts. Lemmy also uses markdown for its’ post formatting. From my understanding what OP has done is that he made this post on Lenmy and has created a front end that basically retrieves the given post from Lemmy and displays it with a more traditional blog style CSS as well as a few other pages that aren’t hosted on Lemmy.

[–] [email protected] 10 points 1 week ago

This is in it's simplest form a blog frontend for Lemmy indeed!

[–] [email protected] 5 points 1 week ago (1 children)

Ok so you’d literally be making a regular Lenny post to some particular community on some particular instance in that case, right?

[–] [email protected] 4 points 1 week ago* (last edited 1 week ago)

Exactly, in this case the actual post is this one and posted it here as a x-post.

Edit: I own my instance, but you don't have to own one in order to deploy this blog frontend.

[–] [email protected] 3 points 1 week ago

The content seems to be hosted on https://0d.gs/

[–] [email protected] 1 points 1 week ago

I sepperate the hosting of the content and the page itself. With a website you do need to still be serving a html page, because it has no backend the page can be served by GitHub for example.

In theory you don't have to touch the website anymore, so you use Lemmy as your markdown frontend.

A constraint like this ensures someone can host their BlogOnLemmy without paying for anything like hosting space or running the instance themselves.

[–] [email protected] 3 points 1 week ago* (last edited 1 week ago) (1 children)

A blog entry on how it works and what it does at a high level could be nice. I'm not sure what I'm looking at, but there must be some API call to Lemmy and it's probably happening on the server due to CORS; not sure how this would work just in the browser if the Lemmy instance has CORS setup...

Edit: OK the instance 0d.gs does in fact not have CORS 😮 That's a little concerning...

Hold up, neither does programming.dev? Uh... @[email protected] and @[email protected] is that safe? I'm not a security expert but doesn't this allow for cross site attacks?

Anti Commercial-AI license

[–] [email protected] 2 points 6 days ago

I've noticed that a more detailed writeup is warranted! So I'll be working on that.

CORS is enabled on lemmy, you have to send the 'Origin' header in order to get the Access-Control headers. Which allows cross-origin for simple requests. No added headers, cookies or other data. So all API calls are made in JS by your browser.

[–] [email protected] 2 points 1 week ago (1 children)

How come I can't see the Lemmy comments on your blog?

[–] [email protected] 2 points 1 week ago

Good question, it's a design choice. Being attached to my name I had no interest in needing to moderate which comments should and shouldn't be showing up under my name. There is a direct link to the posts on lemmy where they can be interacted with.

A second concern is XSS, with my own content I have no worries.