3

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?

Will
  • 842
  • 2
  • 9
  • 16

1 Answers1

3

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)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250