bootstrapped jekyll project fails to load its auto-generated css - jekyll

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

Related

jekyll on github pages ignores custom layout

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).

Jekyll serve generate wrong path in localhost

I believe this is caued by gem "github-pages". When I run bundle exec jekyll serve, all the links is generated with a prefix of /pages/<user_name> or /pages/<user_name>/<repo_name> depends on repository in _config.yml.
For example, /js/jquery.js becomes /pages/<user_name>/js/jquery.js. This make all the JavaScript, CSS, and page broken.
However, it generates fine if it is built by GitHub. Also, if I remove repository in _config.yml cause the following error.
GitHub Metadata: Error processing value 'baseurl':
Liquid Exception: No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository. in /_layouts/layout.html
ERROR: YOUR SITE COULD NOT BE BUILT:
No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository.
Setting JEKYLL_ENV to development solved the problem.
On Windows, you can run the following:
set JEKYLL_ENV=development

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.

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!

Site Not Generating New Files

My jekyll site is generating files fine on my computer but is not working at all on the server; I can edit the _site folder to make the changes happen, but it won't generate on the server. I am running jekyll --server with no errors. Any suggestions?
My _config.yml file is:
server: false
permalink: /:year/:title/
Are you running any plugins? Unless you have a server that can run Ruby, plugins won't run anywhere besides locally. GitHub doesn't allow Ruby to be run for security reasons.
I'm surprised it's generating fine locally, since you should probably have server:true. More info on your server setup would be helpful if this doesn't solve your issues.