Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a "raw" html+javascript page? #187

Closed
alkamid opened this issue Sep 30, 2015 · 2 comments
Closed

How to add a "raw" html+javascript page? #187

alkamid opened this issue Sep 30, 2015 · 2 comments

Comments

@alkamid
Copy link

alkamid commented Sep 30, 2015

I'd like to add a page that would be purely in HTML + javascript that would come up on my domain (alkamid.com/mypage) but not in the post index. I tried simply creating another layout (_layouts/raw-page.html) with {{ content }} only, but javascript (d3.js) is not executing. Specifically, I'd like to add this gist as a separate page: https://gist.github.com/alkamid/29f86cfb22c8bdb080ab. How to do this properly?

@mmistakes
Copy link
Owner

You'll want to create a page outside of the _posts folder. Look at theme-setup as an example of how pages are setup.

Basically you create a folder in the root of your Jekyll site and place an index.md file inside of that with Markdown or HTML. There's a million different ways to do this but one way off the top of my head:

  1. Create a new layout /_layouts/raw-page.html and populate it with the contents from that gist.
  2. Create /mypage/index.md. Add the appropriate YAML Front matter for title and set layout: raw-page and leave the content blank.

When you build your site you should get a page at alkamid.com/mypage/ that looks like your gist.

If you want more info on how Pages work with Jekyll check out the official documentation.

@mmistakes
Copy link
Owner

Also you should be able to just add a raw HTML file (or any file for that matter) in root. If you don't include any YAML Front Matter Jekyll should leave it alone. So instead of doing what I suggested above just create /mypage/index.html and place the contents of your gist in that file.

cjmadsen pushed a commit to cjmadsen/cjmadsen.github.io that referenced this issue Dec 7, 2016
theRealSuperMario pushed a commit to theRealSuperMario/therealsupermario.github.io that referenced this issue Jul 18, 2020
koyumi0601 pushed a commit to koyumi0601/koyumi0601.github.io that referenced this issue Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants