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

4 replies

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 a year ago · Improve this 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 a year ago · Improve this answer

Try something like this:

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

There's more about redirects in the documentation

Answered a year ago · Improve this answer

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

Answered a year ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 83 questions bug 40 questions posts 26 questions metadata 24 questions resolved 24 questions templates 23 questions how 14 questions tags 13 questions markdown 11 questions pages 9 questions More tags →
Subscribe for changes
RSS Feed of latest questions