1

I have setup a Github page successfully using Jekyll and the default Minimal theme on the gh-pages branch. It acts as a nice documentation for my code in the master branch. However I now want it to also render a custom html page.

What do I mean by that?
The html is a completely finished page that doesn't need a template but still needs to be output.

Usually we write in markdown and Github takes care of everything. But this custom html file can't be prepared that way. It has some interactive elements, scripts etc that can't be put down in markdown and expected to be prepared correctly by Github (OR is it actually possible to hack the template to do that?). I don't really care the endpoint of the page, it can be any thing.

If it can be done, please let me know how.

EDIT:

Using the current solution of -

---

---
<html>
.
.
</html>

I am able to partially render the HTML file i.e the formatting of the template is still applied even though I do not want any formatting from the theme at all.

How do I make Github ignore all formatting from the theme for just this html file ?

EDIT2:

I also tried with the following in assets/css/style.scss file based on customizing your theme's css help -

---
---

@import "{{ site.theme }}";
.title{}
.body{}
.div{}

But nothing happened.

EDIT3

I haven't tried with customizing your html layout yet, but that also seems to be a solution.

I also tried with the following directly in the index.md file -

---
layout: doom
---

Where doom is NOT defined anywhere.
This seems to work !!

Community
  • 1
  • 1
jar
  • 2,646
  • 1
  • 22
  • 47
  • Why not just convert the content from markdown to html with header tags, paragraphs, etc.? Then you can put in scripts and such. – DC.Azndj Oct 13 '19 at 20:40
  • @DC.Azndj I am not sure what you mean. I would like to use both the ease of using templates as many of my docs have already been prepared that way. But for a particular case where the doc needs to be interactive and such, i was hoping that there would be a way to somehow tell Minimal to include that custom (already prepared) html file at some endpoint. Does that make sense? – jar Oct 14 '19 at 03:50
  • You have a markdown template that you like to use. The custom html page is an html page that you would like to also apply that markdown template to? Or it is a completely finished page that doesn't need a template but still needs to be output? – DC.Azndj Oct 15 '19 at 05:29
  • Markdown also allows you to insert actual html tags into the file. https://www.markdownguide.org/basic-syntax/#overview – DC.Azndj Oct 15 '19 at 05:31
  • The second one.....it is a completely finished page that doesn't need a template but still needs to be output – jar Oct 15 '19 at 05:31

1 Answers1

1

The docs on using front matter in Jekyll have a note that specifies the following:

If you want to use Liquid tags and variables but don’t need anything in your front matter, just leave it empty! The set of triple-dashed lines with nothing in between will still get Jekyll to process your file.

So at the top of your html file, you can just have the following:

---
---

<html>
    <head>
    ....
</html>

Jekyll will process the file since it sees the set of lines. It won't apply anything since there's nothing inside the lines. After that, the output url is likely following the file structure of wherever that file is located.

EDIT

If you don't want Jekyll to add a theme, you can have a completely empty layout file and use that layout in the front matter of the custom html page.

//_layouts/empty.html
{{content}}
//customPage.html
---
layout: empty
---

<html>
    <head>
    ....
</html>
DC.Azndj
  • 1,346
  • 12
  • 13
  • But the file now itself would be saved as markdown, right? – jar Oct 15 '19 at 05:41
  • So, I tested it with what I was working on. I must say it did work...but partially. The issue is that I want the html to be rendered exactly the way I have drafted it. But because we are using a theme, even though we use the triple dashes, it STILL applies all the formatting of the theme that we are using. Any way to remove the theme just from that particular page ? This is definitely a step forward. I will definitely accept your answer if there is a way to ignore the theme formatting for that particular page. – jar Oct 15 '19 at 06:06
  • Your comments helped me find a possible solution. Do check the edits and if possible you could edit your answer to reflect the same so that I may mark it as a solution. If you want I can edit your solution too and mark it as a solution. Do let me know. – jar Oct 15 '19 at 09:18
  • Yeah, doing it that way is certainly better ! Thanks a lot for your efforts!! – jar Oct 16 '19 at 04:22