Removing Individual Post Pages from Jekyll - jekyll

Currently, when you make a post in Jekyll it auto-creates a permalink for that post, usually https://website.com/blog/15/01/2020/name_of_post
However, how would I go about removing these individual pages from Jekyll, so only the main page exists with all of the content and there aren't any permalinks to posts.
Basically, if someone goes to https://website.com/blog/15/01/2020/name_of_post it would 404 and they could instead only see that post on https://website.com/blog/
I don't want to remove the post themselves, just the individual pages that show only the post.

I resolved the issue by moving all the posts to a collection and switching output to false. This is the new line in my _config.yaml
collections:
hidden_posts:
output: false

Related

Set a global permalink in Jekyll without the path?

I would like all posts and pages on my Jekyll site to have the same link structure: example.com/my-title, regardless of the directory structure I use to store my files.
Looking at the documentation it seems like I should be able to implement this by putting the following line in my _config.yml:
permalink: /:title.
This almost works. All posts (in the _posts/ directory) get the correct URL. And all pages in my site's home directory also get the correct url. However, pages that are in subdirectories still have the directory path prefixed to the url. For example, if I have a page pages/cats/my-cat.md the URL is example.com/pages/cats/my-cat, instead of what I want (example.com/my-cat). If I set the permalink for that page directly in the front matter as /my-cat I get the desired outcome, but I'd rather not do this on every page.
Is it possible to remove the path from all page URLs?
I see a number of other questions about Jekyll permalinks but nothing that addresses this exactly. This answer from 2013 says that pages will "always remain relative path" but that's fairly old, and also seemed like a throwaway assertion rather than an evidence-backed claim.
You can use Jekyll defaults to apply fallback front matter for files based on a type and/or path. It has the same effect as setting the front matter inside each file. Here's how you could apply that permalink to all pages:
_config.yml:
defaults:
- scope:
path: ''
type: pages
values:
permalink: /:title
It's also a great way to set other common fields, e.g. layout.
Official documentation for further details: https://jekyllrb.com/docs/configuration/front-matter-defaults/

How can I get category page hyperlinks of my Jekyll website hosted on GitHub working?

For a Jeykll website hosted on GitHub I created a custom solution (no Jeykll plugin) to display all post links of a category on a page *. I use the setup of GitHub pages for local Jekyll builds and build with bundle exec jekyll serve locally. If visit http://127.0.0.1:4000 and push one of the hyper-link buttons Embedded, Hardware or Software in the left side-bar below Pattern Categories the post links are shown like expected.
However if I visit the website hosted on GitHub I get an "404 File not found" error. From the past I can remember that this could relate to a different handling of Jekylls permalinks in local and GitHub Pages builds. But I cannot remember in detail.
It would be great if someone could help me out.
* Sitenote: Right now instead of listing only the post links for a single category the post links of all categories are listed section wise. But that does not matter w.r.t. to this question.
The problem is that the website isn't located at the root level, so you need to use in _config.yml the base url:
baseurl: /design-pattern-references
Then make use of that setting generating full paths, e.g.: in _layouts/index.html
{{ post.title }}

Jekyll - Generate pages for items in a collection (similar to posts)

I'm making a website/blog that catalogs DIY projects, currently I have each project as a post, and recent posts are displayed on the home page.
What Im trying to do is have a separate page with project/post categories (projects.html). This page lists a collection of post categories that manually I've made, and will not show any actual posts.
I would then like these categories/collection items to be generated into a page that links to a layout where I can specify a FOR loop that will display each post specific to that category on the page.
I've tried many ways to generate pages from a collection of .md files as jekyll does for posts but I can't get this working. Is this possible to do? or is there a way to automatically generate an html page for every .md file in a folder?
Here is a link to the page I'm working with. http://happy-swallow.cloudvent.net/
Thanks!
You can use Collections and specify to render each file in the collection folder as a page:
tell Jekyll to render individual collection pages, in _config.yml:
collections:
my_collection:
output: true
Then create a folder named _my_collection (the folder name must start with an underscore) and every markdown file inside it will have a single page.

Jekyll blog on github page not show my new post but It works on localhost:4000

Sorry, I am new to jekyll.
Recently I make a blog by github-page+ jekyll and use somebody`s template
this one
https://github.com/Huxpro/huxpro.github.io
and modify code to use on my blog
but the problem is that :
Jekyll blog on github page not show my new post but It works on localhost:4000
and I search the answer for some page
but I still could not find the answer....
this is my github
https://github.com/intheblackworld/intheblackworld.github.io
1. If you mean "GitHub not rendering all new posts after a specific post":
Solution is check your date format.
Check your YAML header
You may quote your YAML header:
----
date: "2016-03-16"
----
2. If you mean "GitHub not rendering my very newest post"
Solution is Make another commit and push to GitHub
I encounter this problem too.
Have no idea why but this may help.

How to use :author in jekyll permalink structure for github pages

I have a jekyll/ruby hosted blog on github pages, within which I would like user submitted content.
In the front matter of each markdown file I would like users to be able to state their username:
---
title: some title
author: bobby-tables
---
I would then like to use this in the generation of the permalink to the post
/:author/:title/ i have this set in my _config.yml file.
But actually :author is visible in the url and seems to be ignored/unconverted
I know this works with :categories but this is not semantically correct and is confusing for some bloggers and novice users.
Is there a way to use :author ?
The site is hosted on github pages so i cannot use any plugins, as i cannot generate the _site locally for each update from my home machine.
I have reviewed the documentation at jeykllrb.com but cannot see :author being used/mentioned especially within template tags.
It is also not practical to have permalinks: name/title in the front matter for each markdown file either.
Thanks in advance.
I have just done some tests and I can't get any custom variables in the front matter to be interpreted as part of the permalink.
Looking through the code, what I can understand (still new to ruby) it is only accepting the ones listed here http://jekyllrb.com/docs/permalinks/
At the moment, depending on your workflow categories or tags seem like the only option as you can use plugins. If categories does not make sense semantically then perhaps use tag and explain that they are tagging themselves in the posts that they have written.