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 4 months 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 4 months ago · Improve this answer

Try something like this:

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

There's more about redirects in the documentation

Answered 4 months ago · Improve this answer

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

Answered 4 months ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 28 questions bug 14 questions posts 9 questions resolved 7 questions request 6 questions google-drive 5 questions configure 4 questions pages 3 questions added 3 questions meta 3 questions More tags →
Subscribe for changes
RSS Feed of latest questions