Log in Sign up

Show text file for post?

I've seen with other blogging engines that you can append ".md" or ".txt." to the end of a URL to see the raw text for that given post. Is that possible with Blot posts?

Example: https://www.caseyliss.com/2022/9/8/verizon-esim-conversion and https://www.caseyliss.com/2022/9/8/verizon-esim-conversion.md


2 years ago, 4 replies   Edit question

If you append the query string ?source=true to any post or page on your Blot site, Blot will redirect you to the source file for that post. Would that work?

For example:

Post: https://david.blot.im/layout-and-typography
Redirect: https://david.blot.im/layout-and-typography?source=true

You could embed this link in your template, here's a rough sketch for what to add to say entry.html:

...
{{#entry}}
...
<a href="{{{url}}}?source=true">View source</a>
...
{{/entry}}
...
Answered 2 years ago · Edit answer

Oh, cool! That's a good start. I thought I could get clever, but it looks like a redirect like this doesn't work.

From: {{{url}}}.md
To: {{{url}}}?source=true

The redirect screen with above example.

Would there be a redirect rule that could make appending ".txt" or ".md" (which would be a little more friendly to explain without adding the "View source" link to every entry) work?

Answered 2 years ago · Edit answer

Try something like this:

from: /(.*)\.md
to: /$1?source=true

There's more about redirects in the documentation

Answered 2 years ago · Edit answer

This worked perfectly. Thank you, you're the best!

Answered 2 years ago · Edit answer