Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter post_thumbnail_default not working #712

Closed
gavlinski opened this issue Nov 13, 2023 · 11 comments · Fixed by hbstack/blog#484
Closed

Parameter post_thumbnail_default not working #712

gavlinski opened this issue Nov 13, 2023 · 11 comments · Fixed by hbstack/blog#484

Comments

@gavlinski
Copy link

| `blog.post_thumbnail_default` | string | `images/thumbnail.png` | The default thumbnail image relative to `assets` folder. |

When post_thumbnail_default: images/thumbnail.jpg or post_thumbnail_default: /images/thumbnail.jpg is set in params.yaml, in both cases the image is found at assets/images/ directory but it is not displayed, showing the console warning:

WARN  image not found: /mysite/images/thumbnail.jpg?height=360px

If the image is not found, then there are no errors nor warnings. But image is not displayed neither ways.

How can I make it work? Maybe remove height=360px parameter from somewhere?

Please tell me if you need more information for debugging.

@razonyang
Copy link
Member

Hi, what is the full path of the parameter? It should be hb.blog.post_thumbnail_default. You can also check it with the real working example.

post_thumbnail_default: /images/thumbnail.jpg

https://github.com/hbstack/site/blob/main/assets/images/thumbnail.jpg

@gavlinski
Copy link
Author

Hi, I've used this example as a reference with the same image from repository. I've tried tried several ways, but I couldn't find out why the image wasn't displayed (which warning message only appears when it is found).

Here is an excerpt from my params.yaml:

hb:
  blog:
    full_width: false # when true, the blog layout takes full width.
    sidebar:
      profile:
        # title: Profile title other than site title.
        # description: Profile description other than site description.
        # socials:
      posts:
        recent_count: 5 # the number of recent posts.
        featured_count: 5 # the number of featured posts.
        # style: pills
      taxonomies:
        count: true # whether to show the number of posts associated to the item.
        limit: 10 # the maximum number of the item.
        style: underline
    paginate: 12 # paginate.
    post_thumbnail_placeholder: "" # the text of thumbnail placeholder, default to site title.
    post_thumbnail: true # whether to show the thumbnails.
    post_thumbnail_default: images/thumbnail.jpg
    post_date_format: :date_long # see https://gohugo.io/functions/dateformat/#datetime-formatting-layouts.
    home: # homepage settings.
      # taxonomies: false # remove the taxonomies stat from the homepage.
      featured_posts: 5 # the number of the featured posts.
      main_sections: # leave it empty to include all regular pages.
        - docs
        - blog
        - news

go.mod:

github.com/hbstack/blog v0.22.1 // indirect
github.com/hbstack/blog/modules/featured-image v0.2.21 // indirect

hugo console log:

Start building sites … 
hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e+extended linux/amd64 BuildDate=2023-09-24T15:20:17Z

WARN  image not found: /mysite/images/thumbnail.jpg?height=360px

                   | PT-BR  
-------------------+--------
  Pages            |   141  
  Paginator pages  |     1  
  Non-page files   |    28  
  Static files     |     0  
  Processed images |    73  
  Aliases          |    62  
  Sitemaps         |     2  
  Cleaned          |     0  

Built in 3105 ms
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender

@razonyang
Copy link
Member

razonyang commented Nov 14, 2023

I think it's not the parameter related, I guess you're using /mysite/images/thumbnail.jpg?height=360px (which doesn't exists) in the markdown content.

@gavlinski
Copy link
Author

I don't know where height=360px came from, I didn't provide anything like that at any time during the configuration.

I even renamed the thumbnail.jpg file to thumbnail.jpg?height=360px to see what would happen: the warning disappears, but the image is still not displayed.

Could it have something to do with the pt-br language?

@razonyang
Copy link
Member

razonyang commented Nov 14, 2023

Do you have a public repo for reproducing? I couldn't reeproduce it, or you can invite me to your private repo, and remove me later.

Could it have something to do with the pt-br language?

No.

@razonyang
Copy link
Member

razonyang commented Nov 14, 2023

One more clue is that you can search your content with the mysite/images/thumbnail.jpg keyword, there isn't mysite on the params.yaml.

@gavlinski
Copy link
Author

Thanks for your help! The problem is actually in the baseURL parameter:

baseURL: https://group.gitpages.corp # works fine
baseURL: https://group.gitpages.corp/mysite # does not work

So removing mysite from baseURL makes the problem disappear, at least in the development environment.

@gavlinski
Copy link
Author

gavlinski commented Nov 14, 2023

If this is a bug, it might help you to know that this other section that uses the same directory to read a image file works normally with any baseURL value:

seo:
  favicons: # see https://hugomods.com/en/docs/seo/#favicons-module
    icon: images/logo.png # use logo as favicon.

@razonyang
Copy link
Member

Seems a bug, will take a close look into it later.

@gavlinski
Copy link
Author

Thanks so much! Confirmed it's now working with github.com/hbstack/blog@v0.22.2.

@razonyang
Copy link
Member

My pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants