My Jekyll Post Is Throwing A 404 Error In Production - jekyll

I am using Jekyll and GitHub Pages to host a blog. However, I have the following issue:
I have created a new post in the _posts folder and then built the site locally using the following command: bundle exec jekyll serve. When I access the site on localhost:4000, I can click on the link to the new post and access it.
When I commit my changes to the master branch on this repo, it builds without any errors. However, when I now click on the new post, it throws a 404 Error saying the page could not be found.
How do I resolve this error?

You've hardcoded a link.
/functional/2019/03/02/make-use-of-reduce.html
must be :
/functional/2019/03/01/make-use-of-reduce.html
Note : Your index.html looks like it is integrally hard coded. This is not how jekyll is supposed to be used. This can quickly lead to unmaintainable code base.

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.

"Page Not Found" upon deploying site to Netlify via Github repo

I'm a complete beginner to web development and am trying to deploy my first site via Netlify. Despite my site working fine when being displayed from my local machine, I'm given the following error when navigating to my site's URL:
Page Not FoundLooks like you've followed a broken link or entered a URL that doesn't exist on this site.Back to our site
Since my page is functional on my local machine, I believe the error lies within my Github repo and/or my deploy settings. Here's my repo:
https://github.com/Cotton0419/TestSite
And my deploy settings:
Repository: github.com/Cotton0419/TestSite
Base directory: acme
Build command: Not set
Publish directory: acme/disp
Deploy log visibility: Logs are public
Any help would be greatly appreciated, I can supplement more information if need be.
The Base directory on Netlify is only used by the build environment for a reference to your code base (defaults to root of the repository if not given).
The Publish directory would be relative to the base directory. So in your case disp or acme/disp if using the default.
You are referencing assets in a location that does not exist in your published paths, so they would not exist in your deploy to the CDN.
<link rel="stylesheet" href="../css/style.css">
You should move your assets into your deploy disp folder and edit the correct paths into your code files.
Similar problem I encountered today. I decided to upload an old portfolio I had made a while back. Then for some reason after running the URL on Netlify, nothing happened. The only thing that showed up was a prompt similar to yours -
Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
Back to our site
After revisiting the HTML and CSS files, I realized that I had set the title for my HTML file to porfolio.html instead of index.html which solved my problem!
For this kind of error please kindly check the HTML filename change it into index.html it worked for me!

Jekyll not finding blog posts

Source Code
I am new to Jekyll and got it installed with Grunt and SASS. My issues is that while my test site will show my new posts, When I click on the post link I get an error "Cannot GET /blog/example-post-name".
Grunt doesn't show any errors when running Grunt Serve. However if I run Jekyll serve I get the following errors:
Build Warning: Layout 'article' requested in app/_posts/2015-01-31-optimized-jekyll-site-with-grunt.markdown does not exist.
Build Warning: Layout 'article' requested in app/_posts/2017-03-20-welcome-to-jekyll.markdown does not exist.
Liquid Exception: Could not locate the included file 'blog.html' in any of ["/Users/rich/jekyll-site/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in app/index.html
jekyll 3.4.2 | Error: Could not locate the included file 'blog.html' in any of ["/Users/rich/jekyll-site/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.
It appears that it cannot find anything in my: _includes, _layouts, ect... folders.
Any help would be appreciated.
Since your template files are in the app/ directory, simply build with app as the source directory.
Add the following to your _config.yml:
source: app
Then run jekyll serve as usual.
Try adding blog.html file in _includes folder or use layout: default in your posts 2015-01-31-optimized-jekyll-site-with-grunt.markdown etc.

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

github page doesn't exist (the simple jekyll configuration)

I have the simplest (default jekyll) page on github
https://github.com/pejot/pejot.github.io
When I run locally
bundle exec jekyll serve
it works fine.
but on the github domain
pejot.github.io
it says: "There isn't a GitHub Page here."
what can be a problem that it works locally but not on github? Please take into account that page is basically empty. Is the default one generated by jekyll.
I get it!
github takes gh-pages branch for project page and master for the user one.