0

I know that this question has been asked before here and here. Both have been answered quite poorly, and none of them do what I wish/expect.

So, let me try this again.

Goal:

I have a blog powered by Jekyll. I would like to be able to load my posts via AJAX and use PushState to speed things up. I'm no Ruby developer, so I have a hard time figuring out what the (poorly written) plugins in the afore-mentioned questions do.

Situation:

My posts are all generated using the date in their path, with a trailing slash (meaning, it generates an index.html file):

  • /2014/09/14/post-title/(index.html)
  • /2015/01/02/other-post-title/(index.html)

I cannot change this pattern for SEO reasons; my blog has been online for some years and I would like to keep my URLs working without writing extensive redirection rules.

Question:

What I would like now is, for every post that is rendered as index.html, I have another version called raw.html.

Now here comes the tricky part (where the other questions/answers fail):

I want to use a single template for rendering the post body, both for the index.html file and for the raw.html file. The reason is I don't want any code duplication.

raw.html is basically the exact same as index.html, except index.html has a footer, header, etc. Currently, I'm achieving this through Liquid template inheritance, but I'm willing to change if required.

Anyone any ideas or pointers ?

Community
  • 1
  • 1
wadmiraal
  • 181
  • 7
  • Did you use `permalink` for your imported blog posts ? – David Jacquel Jan 23 '15 at 15:06
  • Yes. But to clarify, I'm not importing anything. I already use Jekyll, I just want to take it to a new level. – wadmiraal Jan 24 '15 at 21:31
  • I had the need to do what you describe, in my own Jekyll instance. See my answer here to see my implementation: http://stackoverflow.com/a/36459375/858275 Instead of raw.html, I refer to the file as `_BARE.html`. It also assumes you are converting from markdown. Is this answer close to what you need? – Jay Sep 27 '16 at 14:49
  • I'll have to look at it, no time now. But yes, I guess that is what I was looking for, thanks! – wadmiraal Sep 28 '16 at 10:04

0 Answers0