0
votes

I'm using siteleaf for my jekyll site. Here's my problem: I created a metadata field called "image" inside siteleaf cms. This will allow the site publisher to add an image. Here's a visual - https://ibb.co/kHcHdG

With out an image the users posts won't show on the site. After creating this metadata field and uploading an image, siteleaf will then create an _uploads folder in my jekyll directory, a folder for all images.

Jekyll ignores folders beginning with an underscore, so I have to input this yaml code inside the config file to fix this. Code Below.

collections:
  uploads:
title: Uploads
  output: true
posts:
  title: posts
  output: true

Inside my _posts folder, I have a markdown file with front matter that looks like this, code below:

---
title: popcorn
date: 2017-11-06 15:33:00 Z
image: "/uploads/15023253524_589c7b137f_k-ab220c.jpg"
layout: post
---

lorum ipsum.

So far, I followed the right directions, I'm not getting any errors in the console or in jekyll. The posts will not show. I've ran into a wall. I've asked on the jekyll and siteleaf forums, no solution.

Here's a link to the repo - https://github.com/pizzapgh/kevins_site

Help would be appreciated so much, thanks.

2
How are you testing your posts? They are being generated fine, everyone but _posts/2017-10-27-burgers-are-good.markdown that contains a wrong layout (should be post) - marcanuy
I'm testing them on github and local. I've thrown a lot of test post in there out of frustration. The post layout is missing because I simply forgot. - Chris Brennan
There is a problem with your gh-pages branch, it just contains the unprocessed files but not the _site content, try removing posts from collections in _config.yml - marcanuy
maybe there's a js in the gulpfile that's preventing from pulling images from the uploads folder. I still can't get these images to show. - Chris Brennan

2 Answers

1
votes

Fixed, finally!

The solution: Go inside my index file and change the following code:

original code

{% if post.img %}
<img src={{ "/assets/img/" | prepend: site.baseurl | append: post.img 
}} alt="{{post.title}}" />
{% if post.img %}

new code

{% if post.image %}
<img src={{ post.image | prepend: site.baseurl }} alt="{{post.title}}" />
{% if post.image %}
0
votes

Thanks for including a link to your repo.

Here's what I did:

$ bundle install
$ bundle exec siteleaf serve

A few warnings show up in the console, but your site is able to build regardless.

I'm able to access your posts now in the web browser just fine, for example: http://localhost:4000/popcorn/

If you were not expecting this URL pattern, you can change your config file. Right now it says:

permalink: ":title/"

For info on customizing permalinks see: https://jekyllrb.com/docs/permalinks/