Jekyll site missing posts when hosted locally; works fine on Github - jekyll

I'm using this template with my site, and github pages hosts it fine. However, when I host it locally, all but one of my posts goes missing.
Inspect Element doesn't give me errors.
rebuilding _site folder causes the same problems.
Any ideas?
Thanks in advance
bundler 1.14.3
jekyll 3.4.0
rvm 1.28
ruby 2.3.3

Post filenames should have the date in the format: YYYY-MM-DD and then the rest of the name, actually you have posts like:
_posts/
├── 2015-1-20-carbon-fiber-forklift-arms.markdown
├── 2015-10-23-smart-seatbelt.markdown
├── 2015-3-12-cooling-fan.markdown
├── 2016-3-12-photogammetry.markdown
└── 2016-5-23-Newton's-Apple.markdown
The only post you can see now is 2015-10-23-smart-seatbelt.markdown because of the month format, their months should be with two digits, just preppend a 0 and they will get published
_posts/
├── 2015-01-20-carbon-fiber-forklift-arms.markdown
├── 2015-10-23-smart-seatbelt.markdown
├── 2015-03-12-cooling-fan.markdown
├── 2016-03-12-photogammetry.markdown
└── 2016-05-23-Newton's-Apple.markdown

Posts with valid date format should work. It should be YYYY-MM-DD-

Additionally you should make sure, that the date is not in the future, so the posts date field should have a date in the past. Also the time must be valid!
So creating a post with the time of 12 o'clock for today and testing it at 10 o'clock the same day won't show up!

Related

Github page blog: html works ok but css and images are 404

I have my blog kray.me hosted on github pages for many years now.
There are others questions related to 404 errors related to Jekyll on SO but are related to case sensitiveness problems which is not the case here.
The site builds correctly locally.
However, on github.com, it seems that all the files located in my /public folder are not copied by Github page engine eg
https://github.com/Kraymer/kraymer.github.com/blob/master/public/img/back.jpg doesn’t result to http://kray.me/public/img/back.jpg
Any help would be greatly appreciated.
OK fixed I had a public repo named "public" that interfered with the "public" dir of the blog repo

Setting a GitHub pages site from a Jekyll-generated page

I cannot setup a new Jekyll-based GitHub pages site based on the tutorials I've read. Here is the full list of steps I took:
Ran jekyll new jek_test. This created a new dir.
Used GitHub desktop to create a git repository in that dir, then pushed it to a new git repository, jek_test.
In the project settings GitHub Pages panel, I choose master branch as source.
So far this had no effect I could see. Navigating to https://gadial.github.io/jek_test/ yielded a 404 error.
I added the following two lines to the projects Gemfile:
source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins
Now, after pushing to GitHub, the https://gadial.github.io/jek_test/ link is working, but the page loaded is obviously incorrect; the CSS is not loaded, the links are wrong, etc.
I guess I am missing several crucial steps, but all the tutorials I've found either go "simply push it and everything will be ok", or seem to assume I am not using a Gem-based theme, meaning all the layouts, css files etc. are explicitly stored in the _layouts directories etc.
Am I going about this the right way? What is the simplest method to get a Jekyll-generated site up and running on GitHub pages?
You are using minima which is the default so, that's not the issue but, if you have a look at your about.md you'll see that it is looking for a layout called page. You currently don't have a _layouts folder
Try creating a folder called _layouts and create a layout in that called page.html with however you want it to display the contents of all files with layout : page
The default page.html can be found here.
You will need to change url to "https://gadial.github.io" and baseurl to "/jek_test".
If this two attributes are not set up properly, Jekyll won't know where to look for your resources.

Build pages with slug.html rather than slug/index.html in Jekyll (ugly URLs)

I have a page with the slug about-us. By default, Jekyll builds this:
/about-us
/index.html
However, I want this instead:
/about-us.html
Reading through the Permalinks documentation, it looked like I could use this in the config
permalink: /:slug:output_ext
However, this produces the same output as above.
How I configure Jekyll to write the pages as their own .html page, rather than in a folder with an index.html?
Jekyll only generates /about-us/index.html if you've permalink: /about-us/ in the page's front matter or if you've permalink: pretty in your config file.
Ensuring neither of the above conditions should generate /about-us.html

Generate all posts in a single subdirectory

I have a jekyll blog with some static files, my blog index is generating at /blog while all the posts are getting generated at /. How can I make it so that the posts get generated inside the /blog subdirectory?
Note that I am not looking to move the whole Jekyll installation to a subdirectory as I still want my sitemap, static pages etc to be at root.
I am not sure what code to provide but I am using this theme with gulp 4 and other upgraded packages.
Change permalink in _config.yml from
permalink: /:title/
to
permalink: /blog/:title/
You can read more about permalinks in Jekyll documentation.

Jekyll extension-less permalinks with markdown

From the Jekyll docs it says (using .md format):
Clean URLs can also be achieved using the permalink front matter variable. In the example above, using the first method, you can get URL http://example.com/other for the file other.md by setting this at the top of the file: permalink: /other
Here is an example my page front matter:
---
layout: page
title: Contact
permalink: /contact
---
Everything works fine when I'm using jekyll serve but when I build and upload to my static host it doesn't work. The file structure Jekyll outputs doesn't make sense for the functionality it claims from the docs.
.
|-- css/
|-- index.html # => http://example.com/
└── contact.md # => http://example.com/contact.html
I want to be able to go to http://example.com/contact and have it show contact.md. I know I could have similar functionality by manually putting my files in folders (and then renaming them all to index.html) like it says in the docs here, but I don't want to have to go through the extra step and I don't prefer the trailing / e.g. http://example.com/other/.
I am using Jekyll 3.0.1
I have found these questions but they don't address the problem I'm facing.
How to link to a page with page.url without the html extension in Jekyll?
How to make all posts have a permalink with custom format "domain.com/blog/title"?
Can Jekyll omit index.html from folder URLs?
I am also using clean permalink in my jekyll blog.
Here is my frontmatter:
---
layout: directory
title: About
permalink: about/
---
Got any different? , it is trailing slash at the end of URL. I know, you don't want to see any trailing slash at the end of URL, but for that you need to use nginx, because Jekyll generate all post/page like this /folder/index.html.
I think you are doing it correctly, it is just a matter of configuring your webserver properly (assuming it supports removing the extension). It works properly locally cause the built in jekyll webserver can do it by default. The docs have info on this here:
http://jekyllrb.com/docs/permalinks/#extensionless-permalinks
On AWS S3 it says you can host with extensionless urls by uploading files with no extension at all, and then setting the content type to text/html. I don't think it is possible to get jekyll to output contact.html as just contact with no extension. So you get the web server to remove the extension, if it supports that (on s3 I use the trailing /).
This has some interesting info too:
https://github.com/jekyll/jekyll/issues/3345