Closed JamesThorpe closed 3 years ago
Ah, damn. I know exactly why that is. It's an unintended consequence of #933. The problem is that if you have a plain old .html
file in your input folder, there's an expectation that'll get copied over as-is. I.e., if my foo.html
file has all the trappings of an HTML file like <html>...</html>
etc. I'm not expecting it to apply any additional layout around that (a different user hit this and was very confused why his <html>...</html>
was being wrapped with a layout file).
On the other hand, once Markdown renders, it's converted to an HTML file (in-memory, but still). That's a "partial" HTML file though so it should get all the layout stuff. The change I made to copy HTML files directly without applying layout seems to have stopped applying to all HTML files, including Markdown output.
A better fix for the actual use case is probably to look for <html
in the document content. If found, treat it as a complete HTML file and don't apply layouts. If not found, treat it as a fragment and apply layouts. That should work for the .html
file on disk, and will be even smarter than just relying on file name. It'll also work for Markdown and other preprocessors since those generate fragments by default.
This will be an easy fix (I hope), should have a patch release out tonight.
Ah, well actually I didn't tell the whole story in my ticket - one of the input files is a (partial) html file (h1
, div
s p
s and a script
tag), with the expectation that it'll get embedded in the layout. Unsure if that changes things or not?
Have read through that ticket - I've updated back to 16, and renamed the .html to .fhtml, and that one is now embedded in the layout, but the .md files aren't.
Yeah, the Markdown files aren't going to work in 16 at all now 😬, so that makes me highly motivated to get a fix out!
Actually think I've already got the code done, so just need to do a little testing and then I'll publish.
I'll probably delist that version from NuGet in the meantime
The fix is rolling out now as 1.0.0-beta.17. Also added some unit tests to cover this situation so the same thing won't regress again the next time I feel like playing with the layout templates.
I've been building a very simple site, along the lines of:
With the
settings.yml
containing a single setting,Layout: /_layout.cshtml
.Up until today the theme/layout was working properly, but beta 16 seems to ignore it entirely. Beta 15 is fine still. The debug output for beta 15 shows:
But no mention of that file at all in the beta 16 output. The main program is still very basic:
The .md files are transformed into .html files still, but based purely on the content of the markdown, but none of the layout.