GitHub Pages - Url Rewrite Support - github

I have setup a GitHub page for a site I am working on, following the steps laid out here (https://pages.github.com/)
The site I have setup is currently hosted under IIS and makes use of the URL Rewrite module.
Is there an equivalent module or similar that I could use to rewrite certain URL requests within my application?

For security reasons, Github pages doesn't allow server configuration files, so, no url rewriting.
But you can use html redirection with the help of jekyll-redirect-from.
This is how github pages advises to redirect.

For Github Pages, just copy index.html and renaming it to 404.html will work.
Reference:
https://help.github.com/en/github/working-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site
https://stackoverflow.com/a/36623117/8106429

Related

Github page version number syntax

I have a github repo that is also a github page. I use it as a CDN like so:
https://agentscript.org/src/Model.js
(agentscript.org is a CNAME forwarder to backspaces.github.io/agentscript/)
I would like to access the code by release number. So for example something like:
https://agentscript.org#0.9.0/src/Model.js
Is there a way for me to do this? The above fails. Maybe a different syntax?
Note that npm publishing allows this to work on npm based CDNs like skypack or unpkg:
https://unpkg.com/agentscript#0.9.0/src/Model.js
https://cdn.skypack.dev/agentscript#0.9.0/src/Model.js
GitHub Pages doesn't offer a feature like this. The reason is that GitHub Pages is designed to host a personal website or a site for your open source project, but isn't designed to be a CDN. The documentation outlines that there are limits, so if you need a CDN, you need to host your project on an actual CDN.

Change headers on Github pages

I am trying to make my website not prone to clickjacking. To do this I need to update the HTTPS headers. My website is hosted on github pages. How can I update the headers in github pages?
So you can enforce https on github pages by checking this checkbox here:
It takes some time to reflect.
Also, if it is not working, some of your css/JS files must be accessed over HTTP, so if any of the external dependencies of your website are requested over HTTP, change that to HTTPS and then it should work fine.

How do i manage content workflow for hexo site?

I've used static site generators like jekyll and had it hosted through github pages just fine using prose.io as a content management system.
I decided I wanted to go with a site using Hexo static site generator, but I cannot seem to figure out a good workflow for publishing content.
To my understanding this is the following in how I'd have to do it:
write *.md text file
hexo generate
(optional) hexo serve (to see local content)
hexo deploy (to publish the public content to whatever site using config.yml). Can publish on amazon S3, github pages, etc
Is there another workflow other than this?
the way I've been doing it before with jekyll+github pages is simply
go to prose.io
Write content
save (which publishes ocntent)
Ideally I'd like to use hexo+github pages the same way I do with jekyll+github pages.
Basically, can github generate static files automatically like it does with jekyll / ruby packages?
I figured out my own answer and posted it on my blog
http://www.tangycode.com/Quick-Start-Guide-To-Hexo-Install/
It covers everything you need to know on how to set up a hexo blog site and manage content workflows
One approach I am trying myself:
prose.io or similar to write and save on github repository
travis-ci.org to build hexo site and deploy
This is how it works:
Edit document on your editor of love
Commit it to your repository
travis-ci.org detects the commit and start working
My .travis.yml do (among few other things) the follow:
npm install hexo-cli
npm install grunt-cli
npm install inside siteĀ“s repository (hexo plugins and dependecies)
hexo generate
grunt deploy-production
hexo deploy (I use this to have a historic of the site stored in the repo itself)
If your editor of choice can direct commit to github repository your have exact same experience you had with Jekyll on GH pages. The advantage here is that you can use third-part plugin what GH pages avoid.
Alternatively, you can use INSTANT, which is a content management tool that you can use on any static website. You just install their javascript and can directly edit content in your website (without any admin dashboard). It saves and serves the content from the client. Pretty neat.
The easiest way is to use a hosting provider like Netlify in combination with a headless CMS, for example Headless (full disclore: I created it).
Netlify can do the build process for you and during that build process, it can fetch content from a headless CMS. Whenever you update content in the CMS, then Netlify does a rebuild.
Then you have your website on the Netlify CDN, a real CMS for your content management and you never need to dive in your code or github files. And that's all for free.

Github page using hexo, how to get my theme supported?

I want to host a simple blog on Github pages. Therefore I set up a repository and used Hexo as a compile and deployment tool.
After testing my site locally I run the following command:
hexo deploy --generate
Sadly I, just a few seconds later, get the following message from Github:
The page build failed with the following error:
The hacker theme is not currently supported on GitHub Pages. For more
information, see
https://help.github.com/articles/adding-a-jekyll-theme-to-your-github-pages-site.
For information on troubleshooting Jekyll see:
https://help.github.com/articles/troubleshooting-jekyll-builds
If you have any questions you can contact us by replying to this
email.
How can I publish my site using the hacker theme? If this is not possible which themes are supported by Github? How do I use them with Hexo?
Bypassing Jekyll on GitHub Pages
It is now possible to completely bypass Jekyll processing on GitHub
Pages by creating a file named .nojekyll in the root of your pages
repo and pushing it to GitHub. This should only be necessary if your
site uses files or directories that start with underscores since
Jekyll considers these to be special resources and does not copy them
to the final site.
Source: https://github.com/blog/572-bypassing-jekyll-on-github-pages
[..] I used the username.github.io repo and deployed directly to master
and it works!
https://github.com/CodeDaraW/Hacker/issues/9

How do I self-host Jekyll?

I don't want to use github to host my new portfolio, I want to host it from my own site. How do I do this properly? Clearly, simply uploading all the files don't work (I just see Jekyll template text).
Has anyone done this?
You have to generate the site with Jekyll, and then upload the generated files to your web server. Jekyll's Usage and Deployment docs explain in more detail.