How can I publish old html commits in my gh-pages branch online? - github

I'm writing a blog post and want my readers to see several old commits (of html) in my gh-pages branch.
In my blog post, I want to say, here's how the code looked in the browser, at this commit.
For example, this is one of the old commits that I want to show: as an html page that someone could view in their browser as the HTML would look in a browser; I don't want to just show them that raw page on github because the code on that old commit is broken and want the reader to see the error that the browser's console would give.
I'm thinking of something like: skorasaurus.github.io/reponame/commithash/index.html ?
Does this exist?

If you click on the "View" button of the index.html file listed on https://github.com/skorasaurus/dtparking/commit/945fae4e059fb12090a8dc22c6cd22e665ebeea2, you will get the exact reference for that file:
https://github.com/skorasaurus/dtparking/blob/945fae4e059fb12090a8dc22c6cd22e665ebeea2/index.html
You can then use the service from htmlpreview.github.io to visualize that specific version:
http://htmlpreview.github.io/?https://github.com/skorasaurus/dtparking/blob/945fae4e059fb12090a8dc22c6cd22e665ebeea2/index.html
(with the console of the browser including: Error: Map container is already initialized.)
See other alternatives at "Can I run HTML files directly from GitHub, instead of just viewing their source?".
You can then try and embed that rendered page in your gh-branch source. For instance (How to embed a “live” web page in WordPress blog posts)
<object data=http://www.example.com width=”650″ height=”500″>
<embed src=http://www.example.com width=”650″ height=”500″ />
</object>
(replace example.com with the full htmlpreview url above)

Related

Can I embed a google document in Github's readme.md using markdown?

I am trying to embed a google docs in Github's readme.md using markdown. Is this possible?
I have done the following:
Published the document to web and copied the iframe code.
Pasted the code in markdown. Nothing happens.
Pasted the code between and nothing happens.
Any suggestions?
This isn't possible. When GitHub renders a README or other text document on the site, it gets passed through a filter to sanitize it and remove anything potentially malicious, including JavaScript and iframes. That's because these documents are rendered in the context of the github.com domain, and any malicious code could steal user credentials or otherwise create privacy or security problems.
Note that even if you could bypass the sanitizer, GitHub sends a Content-Security-Policy header that restricts JavaScript to a single, specific domain and rejects all frames, so your browser would not render such content, and it would use the report URI to send a notification to GitHub that a violation had been detected.
You could save the Google Doc as Markdown, AsciiDoc, or HTML and place it in your repository for people to use if you want it to be visible on GitHub.

Why isn't my github project going live?

I created a subbranch for gh-pages. I don't know why the page isn't getting created. I'm attaching the screen shot of the bash.
Even at the github page, when I hover over the tick mark, it says that github has successfully created the page.
Link to my github
To make a github pages site, you must follow the naming convention for your repository; in your case puneeth8994.github.io.
Also, the main html file should be called index.html.
The following is a great resource to get started on github pages:
https://24ways.org/2013/get-started-with-github-pages/

Can not host a webpage on Github

I have a javascript and html snake game and I want to host it on github I do All the steps and make a gh-pages But I get this error 404 File not found ?when I search Username.github.io/repository-name
Any idea why and how I can fix it? Should I wait for github email After I do the commands??
Most web servers have a "default" page, e.g. index.html, that will be shown when the user doesn't request a particular page. GitHub Pages is no different.
Your repository contains a single file called snakeGame.html, which works just fine if you request it. Unfortunately, GitHub Pages doesn't know that this page should be shown by default. As far as it knows that file has no special meaning.
To get your page to show up at http://peggykh.github.io/Snake/ instead of http://peggykh.github.io/Snake/snakeGame.html, you should rename your file to index.html.

How to make dynamic github badges, that is, images in README which change state?

How do you add a "badge" in GitHub README so that it is dynamic? By "badge", I mean
The question is even if one puts a URL in GitHub README which maps to a server returning an svg/png, how does it update automatically on GitHub README page?
As an example if you visit the link
, you'd see the updated status of the issue (which is closed), but my GitHub README page still shows outdated badge, that is, shows the issue being open.
What is an example server code (say in golang) which can render github badges dynamically?
It's just an image at a URL. It's up to the server (your example looks like Jenkins) to decide what image to provide.

How do I get a multipage site from GitHub Pages' automatic generator?

I am using the 'Automatic Generator' of GitHub Pages, and I see it only generates a single index.html and other web resources.
How it works if I want to have a multi-page website generated from other markdown files?
You can get github to generate .html files from .markdown files by ensuring the top of the .markdown starts with the ---- block like this:
---
title: This will be used as the title-tag of the page head
---
hello
=====
**You are here!**
Found this here:
http://xlson.com/2010/11/09/getting-started-with-github-pages.html
Github will automatically create pages for you, if you include the markdown file.
index.html - yourname.github.io/project-name/
about.md - yourname.github.io/project-name/about
foo.md - yourname.github.io/project-name/foo
Tested this and working.
If you want to get into the really fun stuff - you need to get into Jekyll http://jekyllrb.com/
You pull the generated page, make any modification and addition you like (including adding new pages and links between the pages), then commit and push.
The generated single page helps you to make you start. You can duplicate its layout to generate other similar-looking pages by hand.
See Help.
Github Pages uses the Jekyll site generator which suports converting any number of markdown files to HTML for you, and applying the surrounding template via a layout file. See github's documentation on using Jekyll: https://help.github.com/articles/using-jekyll-with-pages
The trick is that you have to download a jekyll template/theme and include it in your gh-pages branch on your own (standard jekyll configuration), instead of just allowing Github Pages to auto-generate the one file using its own built-in themes.
GitHub Pages' automatic generator only generates one page.
You can add the new file directly, github page publishes all data (including data inside the subfolders) for you.
Just made gh-pages-generator - the utility to generate site with the navigation from multiple markdown files having links to each other.
"Github pages" hosts web page from index.md / readme.md as main page . However if you have an index.html file then it'll be hosted from html file.However , if you are trying to host a multi page website using "Jekyll themes" then Jekyll theme is not straightaway deployed in subsidiary pages .
Case 1) You are using markdowns to host your pages
index.md -> main page
page1.md -> page 1 of your website
..
so on
To generate a multiple page website using github page just give relative path to the required page without extension i.e.
make a button
Go to next page
And by clicking on this button you will be directed to page1 with jekyll theme deployed