Share what you are working on and using!

I think so @gytisrepecka ! Since this solution is just CSS around an iframe, it should work with PeerTube videos as well.

Is there a way to edit the information that is shown for the title of each post? I don’t title my posts. Is there a way to modify the app so that the slug is what is shown for the title of the post in the archive? My blog is publicanxiety.us.

You can edit the post metadata, which will allow you to pick the slug for the post. Or, a trick I use is, to select a title that matches the post slug I want, then publish the post, then quickly edit the post to update the title to the one I want.

In your case, you can publish your posts with a title, then quickly edit it to remove the title. The post slug should be retained then.

Hmmm yes the posts already have title slugs, but how do I get the archive app to use these slugs as their names? Currently, it just lists them as “untitled.” https://publicanxiety.us/archive

EDIT: nvm, i figured it out! thanks for the rad app!

EDIT 2: the links aren’t working unless i right click to open them in a new tab, the app errors with this message: Requests to the server have been blocked by an extension.

I also have to right-click and open new link in tab for my own Archive page. I don’t get an error though when I just click the link. I mean nothing happens when I click the link.

Hey @yungleary & @dino, to fix this problem, you need to make it so that the links open in a separate window. To do this, go to beans.html and add target=_blank to the respective anchor tags on lines 36 & 38. In context, the links will now look something like this (lines 35-39):

{%- if post['title'] == '' -%}
                <li><a href="{{blogurl}}{{post['slug']}}" target="_blank">{{post['slug']}} - {{ post['created'][:-10] }}</a></li>
              {%- else -%}
                <li><a href="{{blogurl}}{{post['slug']}}" target="_blank">{{post['title']}}</a></li>
              {%- endif -%}

That should allow the links to work with the app embedded. I tested it out in Glitch and it works. Let me know if you’re able to get it working!

1 Like

Ah so that was the issue then, if it was embedded. Thanks for the wonderful fix CJ. I just updated my Archive apps and they all work beautifully now.

1 Like

There’s a really cool PHP wrapper of the Write.as/WriteFreely API being built! Could be relevant to you @bugbuster. If anyone is experienced in PHP, feel free to chip in and help!

Looking forward to the projects that could come up from something like this…

1 Like

I just tried this and when I previewed the app I get this:

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

My blog is sermonpoppers.com

Hmm that’s strange! Are you trying to use this for your blog or are you accessing the link to my app? If it’s for your blog, could you send over the link to your remixed app? There might be something wrong in the code that needs fixing.

Thanks! Ah, that’s some old code that had to be changed. Here’s an updated version of the app with your blog. Just use this link to get a random post: https://sermonpopper-random.glitch.me/get

Thanks for the help. How do I add this to my blog?

Just create a placeholder post for it (title it “Random” & make sure to pin it to your blog). Then add the following code to the Custom JavaScript in your blog’s settings:

const pinned = document.querySelector('a[href*="https://sermonpoppers.com/random"]');
pinned.href = 'https://sermonpopper-random.glitch.me/get';

This will make it so that anyone that clicks the link to the “Random” post will be redirected to, well, a random post! Hope that helps and let me know if it works for you @sermonpoppers.

It didn’t work. You can see the pinned random post on my blog and when you click it it leads to the post itself

If you are viewing your homepage while logged in to write.as, the link to the random post will be different. On my site, I use the script below to check for the link when logged in.

document.querySelector('a[href="/dino/random"]');

Here is the entire script I have for the random glitch app. The first one is to update the link if viewing the site while not logged in, the second one is for viewing the site while logged in or if viewing the site using the original write.as domain/url.

var a = document.querySelector('a[href="https://journal.dinobansigan.com/random"]');
if (a) {
  a.setAttribute('href', 'https://random-journal-post.glitch.me/get');
  a.setAttribute('title', 'Get a random post');
}
var b = document.querySelector('a[href="/dino/random"]');
if (b) {
  b.setAttribute('href', 'https://random-journal-post.glitch.me/get');
  b.setAttribute('title', 'Get a random post');
}
1 Like

Just logged out and it worked perfectly. Thanks for letting me know about the code

1 Like

You are welcome.

Just went on my blog again and it isn’t working anymore.

Could you check to see if the Custom JavaScript is enabled in your blog’s Customize settings? That might be the issue.