khusika / FeelIt

A clean, elegant but advanced blog theme for Hugo
https://feelit.khusika.dev
MIT License
164 stars 60 forks source link

[QUESTION] Image not showing #43

Closed khannzxc closed 3 years ago

khannzxc commented 3 years ago

I have create a post in posts folder. And in front matter I have added the image name and src

resources:
  - name: "featured-image"
    src: "featured-image.webp"

But the image is not displaying. Clear the cache several times but not working. But in the default posts images are displaying correctly.

Steps to follow

khusika commented 3 years ago

May i know your specific post & image location?

khannzxc commented 3 years ago

My post location is exampleSite/content/posts/test/test.md and my image location is exampleSite/content/posts/test/

and the front matter is

---
weight: 1
title: "Test Post"
date: 2020-03-06T21:29:01+08:00
lastmod: 2020-03-05T21:29:01+08:00
draft: false
author: "FeelIt"
authorLink: "https://feelit.khusika.com"
description: "Discover what the Hugo - FeelIt theme is all about and the core-concepts behind it."
# featuredImage: "featured-image"
# featuredImagePreview: "featured-image-preview.webp"
resources:
  - name: "featured-image"
    src: "featured-image.webp"
tags: ["installation", "configuration"]
categories: ["documentation"]

lightgallery: false

toc:
  auto: false
---

Some body text

and the error pics are: dellll

khusika commented 3 years ago

My post location is exampleSite/content/posts/test/test.md and my image location is exampleSite/content/posts/test/

Correct your post location into exampleSite/content/posts/test/index.md, if yourimage.webp is inside post/test

resources:
  name: "featured-image"
  src: "yourimage.webp"

or

featuredImage: "yourimage.webp"
khannzxc commented 3 years ago

Yes, it fixes the issue. when I renamed the post to index.md But when I use netlify cms and add title to the forexample test title it creates the post in exampleSite/posts folder with file name test-title.md. Then it creates the problem even the images are present in exampleSite/posts folder.

Screenshot is attached below.

dellll

I think it is not working with cms then, because cms does not create index.md or if it create index.md by using post title of index then there will be only 1 index file in posts folder

khusika commented 3 years ago

Sorry, i can't answer related to the CMS configuration. You have to adapt it by yourself.