CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.82k stars 1.55k forks source link

Related Contents pictures not loading once deployed in GitHub #198

Closed VasilyRakche closed 3 years ago

VasilyRakche commented 3 years ago

Describe the bug

The picture for Related content are not loading. That only happens once deployed on GitHub, testing it locally with Hugo works ok.

image

To Reproduce

I am using example files provided. Building them with Hugo v0.80.0/extended Just replacing the baseurl line with:

baseurl: https://vasilyrakche.github.io

Build files are written into folder public and pushed to my github repo You can check how page looks like once deployed here.

Environment

Additional context

Content of config.yaml

baseurl: https://vasilyrakche.github.io
languageCode: en-us
theme: hugo-theme-stack
paginate: 5
title: Example Site

# Change it to your Disqus shortname before using
disqusShortname: hugo-theme-stack

# GA Tracking ID
googleAnalytics:

# Theme i18n support
# Available values: en, fr, id, ja, ko, pt-br, zh-cn, es, de, nl
DefaultContentLanguage: en

permalinks:
    post: /p/:slug/
    page: /:slug/

params:
    mainSections:
        - post
    featuredImageField: image
    rssFullContent: true
    favicon:

    footer:
        since: 2020
        customText:

    dateFormat:
        published: Jan 02, 2006
        lastUpdated: Jan 02, 2006 15:04 MST

    sidebar:
        emoji: 🍥
        subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        avatar:
            local: true
            src: img/avatar.png

    article:
        math: false
        license:
            enabled: true
            default: Licensed under CC BY-NC-SA 4.0

    comments:
        enabled: true
        provider: disqus

        utterances:
            repo:
            issueTerm: pathname
            label:

        remark42:
            host:
            site:
            locale:

    widgets:
        enabled:
            - search
            - archives
            - tag-cloud

        archives:
            limit: 5

        tagCloud:
            limit: 10

    opengraph:
        twitter:
            # Your Twitter username
            site:

            # Available values: summary, summary_large_image
            card: summary_large_image

    defaultImage:
        opengraph:
            enabled: false
            local: false
            src:

    colorScheme:
        # Display toggle
        toggle: true

        # Available values: auto, light, dark
        default: auto

    imageProcessing:
        cover:
            enabled: true
        content:
            enabled: true

### Custom menu
### See https://docs.stack.jimmycai.com/configuration/custom-menu
### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter
menu:
    main:
        - identifier: home
          name: Home
          url: /
          weight: -100
          pre: home

related:
    includeNewer: true
    threshold: 60
    toLower: false
    indices:
        - name: tags
          weight: 100

        - name: categories
          weight: 200

markup:
    highlight:
        noClasses: false

Link to the demo site and/or source repository

Repo with build files Deployed website Source code is used from the exampleSite in the theme repo.

CaiJimmy commented 3 years ago

This seems an issue related to GitHub Page. Another user reported this a few days ago too: #194

For example, this URL returns 404: https://vasilyrakche.github.io/p/placeholder-text/_hu958d513eeefe5556a31d065479ecc5ac_14205_7bffa90d1e66ca9b8184fda08a99dc7e.jpg

However, the file exists under its correct path: https://github.com/VasilyRakche/vasilyrakche.github.io/blob/master/p/placeholder-text/_hu958d513eeefe5556a31d065479ecc5ac_14205_7bffa90d1e66ca9b8184fda08a99dc7e.jpg

I don't know how to solve this. Could you test if this bug persists even with another image? (not the sample one)

CaiJimmy commented 3 years ago

So I found this discussion in Github Support Community: https://github.community/t/error-404-for-image-file-via-pages-which-exists-in-repository/10880

The name of the image starts with an underscore, that must be the reason.

Try to place a .nojekyll file in the repository with the main Github Pages content.

VasilyRakche commented 3 years ago

Thanks placing a .nojekyll file in the build repository for GitHub pages deployment solved the problem!