Trouble getting collections working with github pages - collections

there.
Here's my config.yaml:
# Permalinks
permalink: pretty
relative_permalinks: true
# Setup
title: Tom Critchlow Title
tagline: My Github Site
url: http://tomcritchlow.com
paginate: 1
baseurl: /
author:
name: Tom Critchlow
url: https://twitter.com/tomcritchlow
email: tjcritchlow#gmail.com
collections:
- poetry:
output: true
And here's my folder structure:
-config.yaml
-index.html
-archive.md
_layouts
_poetry
_posts
Yet on my archive page when I do this:
{% for poem in site.poetry %}
hello world
{% endfor %}
Nothing happens... I'm also struggling to render anything in my poetry collection.
You can see the github repo here:
https://github.com/tomcritchlow/tomcritchlow.github.io
What am I doing wrong? How do you get collections working on Github pages? I'm totally new to github. Thanks.

You had config.yaml instead of _config.yaml

Looking at you github repository gave me some ideas about your problems.
First, answering to your question, your config.yaml file MUST be named _config.yml if you want Jekyll to take it into account.
But, there is a lot of other issues all over you site (empty _layouts/default.html, no _layouts/page.html, _layouts/blog.html as no front matter, baseurl/ set to / instead of "",...).
I really think it's better to work on an new clean version and copy you content to it.
gem update
make a new working folder eg: mkdir newjekyll
go to it
jekyll new .
copy your content to your new jekyll including your collection
jekyll serve
all will be ok on 127.0.0.1:4000/

Related

In my theme folder ‘sfwd-lms/includes/shortcodes/ld_course_list.php’ file overwrite not working

I'm trying to overwrite my ld_course_list.php file, but I'm having trouble. I tried to use the same plugin folder structure in my child theme, but it did not display the child theme file content.
Plugin Name: LearnDash LMS
Plugin file location : wp-content/plugins/sfwd-lms/includes/shortcodes/ld_course_list.php
Child theme file location : wp-content/themes/Awake/sfwd-lms/ld_course_list.php
The other two locations were also tried:
(1) wp-content/themes/Awake/sfwd-lms/includes/ld_course_list.php
(2) wp-content/themes/Awake/sfwd-lms/includes/shortcodes/ld_course_list.php
Thanks
Overwriting LearnDash plugin files is not as straight forward as woocommerce, they follow a very different folder structure, try this path:
wp-content/themes/Awake/learndash/shortcodes/ld_course_list.php
or
wp-content/themes/Awake/learndash/ld_course_list.php
Unfortunately there is no proper official documentation on this. Check these articles for more info Article 1 | Article 2

Jekyll collection with subdirectories and own index.html

Hello and thank you in advance for any help/suggestions regarding my issue,
Background information: I have been working with the Jekyll static-site generator, The theme I am using has one blog feature being posts this is in use already.
The existing loop shows all the markdown files within its directory:
{% assign posts = paginator.posts | where: "lang", page.lang %}{% for post in posts %}
I am currently using Jekyll 3.8.5.
Goal: Create a second blog being notes. However, this blog should be able to house 3 subdirectories with the option to filter between the 3 subcategories. The top-level directory is ‘release notes’ this page should show all subdirectories.
Each subdirectory should only show their specific files i.e. iOS only shows the specific release notes filtered by category ‘iOS’ in each markdown file.
I want to create a second blog called ‘release notes’ housing 3 different sub-collections (categories), being Android, iOS, and Windows; each subdirectory of release notes will host several Markdown files which will all be of the same type (same tag or category)
Structure:
_releasenotes
- ios
- android
- windows
I have tried to implement the function using the approach from this thread: [https://stackoverflow.com/a/38870168/1914835][1] without complete success.
Approach: Creating an individual index.html for _releasenotes this will show all markdown files within that directory using this loop:
{% assign notes = site.releasenotes| sort:'title' %}
{% for note in notes %}
{% if page.url != note.url and include.category == nil or note.url contains include.category %}
<a href={{ note.url | prepend: site.baseurl }}>{{note.title}}</a>
{% endif %}
{% endfor %}
This code is then injected into the index.html within the release notes directory which simply looks like this:
---
title: release notes
---
{% include list-releasenotes.html %}
Outcome: Once the site builds it replaces the created index.html with the original site index.html which defeats the purpose.
Each sub-collection has its own ‘index.html’ which for-loops all the MD files within. Jekyll however does not use the provided index pages for each collection but rather generates its own index.html being the (wrong) ‘landing page’.
Jekyll generates releasenotes/index/index.html :(
Giving me:
public
- releasenotes
- index.html (the original site index.html)
/ios
/android
/windows
/index/index.html (mine that includes another html)
Instead of:
public
- releasenotes
- index.html (Mine which includes another html)
/ios
/android
/windows
How can I configure Jekyll that it doesn’t convert my index.html (in _releasenotes) to a subdirectory but should use my created index.html as the entry page for release notes?
Keeping in mind that I can see all release notes within the release notes folder and within the subfolder, I should be able to filter between iOS, Android and Windows.
Here are the collection configurations:
collections:
releasenotes:
output: true
android:
output: true
ios:
output: true
portal:
output: true
The _releasenotes/index.html collection item file is output to releasenotes/index/index.html because of the default permalink setting.
You can overwrite it by setting this in the front matter for that file:
permalink: /releasenotes/index.html

How to fix the error `found no layout file for "HTML" for "page"` in Hugo CMS?

I recently imported content from my WordPress page into Hugo. When I run hugo serve I get following error messages:
WARN 2020/02/17 20:51:06 found no layout file for "HTML" for "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
The page in question starts like this:
---
linktitle: "The Title of the Post"
title: "The Title of the Post"
author: "Franz Drollig"
type: post
date: 2020-01-09T14:41:55+00:00
url: /the-title-of-post/
categories:
- Uncategorized
weight: 10
---
This is the content of the post. This is the second sentence of the post.
It is located in mysite/content/posts/YYYY-MM-DD-title.md.
The layouts directory is empty. However, the themes directory contains the book theme. This theme is also configured in the config.toml.
Another post, starting like shown below, is rendered correctly.
---
author: "Michael Henderson"
date: 2014-09-28
linktitle: Creating a New Theme
menu:
main:
parent: tutorials
next: /tutorials/github-pages-blog
prev: /tutorials/automated-deployments
title: Creating a New Theme
weight: 10
---
## Introduction
Why is my post not rendered properly? How can I fix it?
Okay so here is what is likely happening:
You have a theme you added as a git submodule and you recently re-cloned your project. Guess what? Your submodule needs to be re-downloaded as well.
You can do this with:
git submodule init
git submodule update
Then your project will load without errors.
I don't have experience with Hugo, but figure I'd comment if it helps to point you in the right direction.
The front matter seems very different between those two documents. I'm thinking the type: post is probably the culprit.
What happens if you remove the post front matter altogether?
These links may also be helfpul:
Front Matter | Hugo
Hugo's Lookup Order | Hugo
You have to create the layouts needed; by default the layout of page is named single.html, and the layout of section is named list.html.
Even if you would not use those as a real template, you have to create it in order to avoid that WARN.
So, create those files inside layout/_default: single.html list.html. Also, if you feel applied write some comment with a hugo template inside each file like this:
{{ "<!-- Layout with no content to avoid WARN message about missing page layout -->" | safeHTML }}
If you use hugo academic theme, please try this:
$ hugo mod clean
$ hugo server
or
$ hugo mod clean
$ hugo mod get -u ./...
$ hugo server
Ref:
Error: File “not found” or “failed to extract” | Troubleshooting
In my case, I missed this step:
echo theme = \"hugo-future-imperfect-slim\" >> config.toml
Which adds your theme to the configuration. After that, it was using the right Kinds / Layout elements from the theme. More info in the quick start: https://gohugo.io/getting-started/quick-start/

Ghost Blog: Dynamic Routing with static home page not working as expected

I have just set up a Ghost Blog. This is a clean install on a VPS, and it is up and running correctly.
By default, Ghost shows a list of posts when opened in the browser. I would like to have a home page at the / location, and have my posts available at /blog. From what I can tell, this can be achieved by using Dynamic Routing.
To simplify this, I thought I would be able to page (Ghost has the concept of pages and posts) as the home page. I could then render this page using the already existing page.hbs template.
Here is my routes.yaml file:
routes:
/:
data: page.home
template:
- page
collections:
/blog/:
permalink: /blog/{slug}/
template:
- index
taxonomies:
tag: /blog/tag/{slug}/
author: /blog/author/{slug}/
I have a page called home, but when I load the home page, I get an empty-ish page: just the footer displays.
There are no hints in the log that tells me what could be happening. Am I understanding routes.yaml correct? Is page.home not how to pass data to a page?
I asked this question on forum.ghost.org and got the answer I was looking for.
The solution is to use the long-form data notation as below. My routes.yaml file now looks like:
routes:
/:
data:
post: page.home
template: page
collections:
/blog/:
permalink: /blog/{slug}/
template:
- index
taxonomies:
tag: /blog/tag/{slug}/
author: /blog/author/{slug}/
Now, when I load example.com the page home is loaded, and when I navigate to example.com/blog the blog is loaded

No images in GitHub Pages RSS feed

I recently set up a blog with Jekyll / GitHub Pages and it automatically provides an RSS feed.
Embedding images in the blog itself works perfectly fine, using:
{{ site.baseurl }}/...
but in the RSS feed, they are not displayed.
I also noticed that this website: https://validator.w3.org/feed/ throws quite some errors, always saying that description should not contain relative URL references: /blog/assets/images/IMG_8196.jpg.
It would be great if you had an idea on how to solve this, because absolute URLs aren't too great especially when it comes to testing on own server / localhost.
Thank you in advance!
In _config.yml, set url and baseurl, if needed.
Any link or resource in your feed.xml must be pointing to an absolute url. This file is consumed my tools that only knows where to find things with absolute urls.
{{ site.url }}{{ site.baseurl }}/myPath/myFile.html
This can also be done with the new absolute_url filter
{{ "myPath/myFile.html" | absolute_url }}
And this is true for links, images, css, js, and so on.

Resources