jekyll on github pages ignores custom layout - jekyll

I'm trying to clone the repo https://github.com/TowerofHanoi/towerofhanoi.github.io on my GitHub, based on the website https://toh.necst.it and publish it on a new GitHub pages instance. I'm doing this to check that a new article is well formatted for publication.
I'm having trouble generating the website on GitHub pages, the site is somehow bad: https://mencucci.github.io/towerofhanoi.github.io/ (my repo: https://github.com/Mencucci/towerofhanoi.github.io).
Locally on my Ubuntu machine, I can get the site to render properly with the following commands:
bundle init
bundle add jekyll
rm -rf \_site && bundle exec jekyll serve --verbose
I couldn't get the remote to build properly.
I tried:
adding a valid theme (no changes)
using a custom build action (no changes)
I noticed a difference in the logs: local, and github. The local log references the /_layout directory, but the remote one does not. Maybe it doesn't "see" the theme?
Thank you for your time

Figured it out, my main issue was that I was running the site using the default url, which hosts the site at <username>.github.io/<repo_name>. Some hard coded elements assumed that the site be hosted at domain root instead. I solved my issue by using a custom domain, which mapped the to the base domain (empty path).

Related

How can I fix 404 error importing css on GitHub Pages?

I currently have the following Git Repository:
https://github.com/SebastianGode/ansible-collection-cloud/tree/gh-pages
And the GitHub Page link:
https://sebastiangode.github.io/ansible-collection-cloud/
The problem is that GitHub Pages will only solve the index.html and will throw an 404 for all required css and image stuff:
As the documentation is getting automatically generated by a travis-ci pipeline it's probably impossible to change paths, but as it works when hosted it locally it also should work on GitHub pages.
Is there any solution to this problem?
I fixed it.
GitHub has Jekyll running behind it which will mess up special paths (here the underscore paths). You can disable jekyll by just creating a .nojekyll file in the root directory of the branch. If you use travis-CI for something like that and run a tox script just call the command touch {toxinidir}/.nojekyll
This will result in a working website for me.

Jekyll command bundle exec jekyll serve automatically loads site made previously

I am working with Jekyll on a new project. I created a new project by running jekyll new [folder name] then ran bundle exec jekyll serve. However every time I run that command files from a former jekyll project get put in the folder! I am not using this project anymore (more of me learning jekyll on my own) so I even deleted the folders. Still, this old site files get loaded.
I even tried serving the site over a different port number (4001, not 4000), and uninstalling and reinstalling the jekyll gem. What is going wrong? Thanks!
This is resolved.
I ended up creating a blank default index file in the root. When I did this and ran jekyll serve, the index file of the former site ceased to be generated. Still generated another page from the site, but I am assuming I can prevent that the same way.

How should I set up my repository using GitHub pages so I can see all the files that the site uses?

Can I set up my repository so that I can see all the files (html and css) that my site uses in the repository while still using the GitHub page generator?
I want to use github.com to maintain my multi page site, without installing Jekyll locally.
After you create your github repo go to the settings and select the option to host from the docs directory I found this to be the best method to host my websites that way you done have to mess with different branches unless your in to that thing.
It is not required for you to use Jekyll I personally have never used it. It is to wordpress esq.
What you can use instead of Jekyll is a static site generator or spa to precompile your website content add the static content to the doc directory and push your repo.
Github will generate a url for your that will also be available in your settings. You can also add custom domains.
I recomd using a static site generator performance and seo is the reason.
If you create a Jekyll website on your local machine in /some/path/website/, initialise your Git repository there:
cd /some/path/website/
git init
Then you can push this to your remote Github repository and all of your files will added and viewable.
I don't think you can initialise a Jekyll website in your remote repository though.
From their documentation:
Jekyll's simplified build process with GitHub Pages is one of the biggest advantages of using Jekyll instead of other static site generators. GitHub Pages manages your site's build process with a single push to your site's publishing branch. This is Jekyll's build process for managing your site:
Push file changes to your pages publishing branch (my emphasis)
GitHub Pages publishes your site.
It turned out that the reason I was not seeing many files was that there was only the index.html that I created using the tutorial at GitHub Pages
The reason I thought there must have been other files was that the theme I picked looked a whole lot better than my helloworld.html

bootstrapped jekyll project fails to load its auto-generated css

I've created a new jekyll project precisely following the simple command sequence at https://jekyllrb.com/. However it seems like the server is not looking for the right main.css:
GET http://example.com/css/main.css 404 (Not Found)
This error in the browser console seems to imply an irrelevant domain for a local project, so I wonder whether those instructions just mentioned are not what one should do for bootstrapping and running/testing a jekyll project on your local server. In that case, what is the right procedure for working locally? and is there an automated command for setting a different host name for deploying to a real server?
I am using a fresh install of jekyll 3.2.1.
Thanks!
Dirty temporary patch (because of this issue).
In _config.yml, set url: http://matanster.github.io/bloglike or wathever is your production url.
Create a config_dev.yml and add url: http://127.0.0.1
Locally, you can serve with :
bundle exec jekyll serve --config _config.yml,_config_dev.yml

Subdirectories in openshift project cannot be found

I built a site using a php openshift project and accessing the root directory via http works fine. However, all the root directories give me a 404 not found, like this one: http://test.toppagedesign.com/sites/
I checked with ssh, and /app-root/repo/sites and app-deployments/current/repo/sites/ both exist.
EDIT
Added a directory called php and now I have 503 errors for everything...
EDIT 2
I deleted the php directory, now the 503 errors are gone. However, I do still get 404 errors for the subdirectory.
Here is my directory tree: http://pastebin.com/hzPCsCua
And I do use git to deploy my project.
php is one of the alternate document roots that you can use, please see the March Release blog post here about this (https://www.openshift.com/blogs/openshift-online-march-2014-release-blog)
As for the sub-directories not working, can you ssh into your server and use the "tree" command to post the directory/file structure of your project? Also are you using Git to deploy your project or editing files directly on the server?
You need to have an index.php or index.html file in any directory that you want to work like app-domain.rhcloud.com/sites , if you just have sub-directories, how would it know what to show? Also, indexing (showing a folders contents) is not enabled for security reasons, and I believe there is no way to enable it.
This sounds like it could be a problem with how you are serving your static content.
I recently created a new sample app for OpenShift that includes:
a basic static folder
an .htaccess file (for serving assets in production)
support for using php's local server to handle the static content (in your dev environments)
Composer and Silex - a great starting point for most new PHP apps
You can serve the project locally if you have PHP-5.4 (or better), available in your dev environment:
php -S localhost:8080 -t static app.php
For a more advanced project that is built on the same foundation, take a look at this PHP+MongoDB mapping example. I wrote up a blog post with some notes on my process for composing that app as well.
Hope these examples help!