Personal GitHub Pages site with custom domain conflicts with another repo

I just updated my personal site to use Hugo and everything looks fine on deploy except one of my content sections. The “droppin-dimes” section shows a 404 not found error on my website. I’ve been aligning versions, checking for syntax errors, etc., for an hour and can’t seem to figure this out. Any tips?

the index.html file in “layouts” contains the linked image to get to the page that won’t appear: jmathena1.github.io/layouts/index.html at main · jmathena1/jmathena1.github.io · GitHub

gh-repo: GitHub - jmathena1/jmathena1.github.io: John Mathena's personal website repository

This is something very strange on the GitHub Pages side. I cloned your site and stood up a GitHub Pages site. I added some debugging to the workflow:

        run: |
          hugo \
            --gc \
            --minify \
            --baseURL "${{ steps.pages.outputs.base_url }}/"
          find ./public -type f

The find command shows this:

./public/files/final-paper-arab-spring-news-analysis.pdf
./public/files/johns-website-resume.pdf
./public/files/2018-ldchd-health-equity-report.pdf
./public/categories/index.xml
./public/droppin-dimes/index.html
./public/droppin-dimes/index.xml
./public/droppin-dimes/posts/2018-05-05-lahboul/index.html
./public/droppin-dimes/posts/2020-09-23-down-time/index.html
./public/droppin-dimes/posts/2020-10-03-survivors-march-down-hilton/index.html
./public/droppin-dimes/posts/2018-05-06-Let-us-grow-up/index.html
./public/droppin-dimes/posts/2020-11-03-scared/index.html

So Hugo is obviously publishing the files.

And if you download the build artifact and unzip+extract you’ll see the files too.

thank you for reminding me of some basic debugging steps! i need to remember that i can execute shell commands in these workflows to get stuff.

it’s very odd indeed. at first i thought i must’ve left a syntax error somewhere that’s causing the link generated to break, but i couldn’t find anything. this gh action comes from the hugo docs and i think matches what they provided. thanks for digging into this

Did it work before you added the custom domain name? I’d go back to that point and make sure everything’s working.

One thing I noticed in your templates is that you do this kind of thing a lot:

<a href="/the-strays">

Hardcoding URLs isn’t a great idea, because what they’re relative to might change. Better to do this:

<a href="{{ `the-strays` | relURL }}">
1 Like

the-strays and droppin-dimes actually used to be their own repos and i decided to move them into my gh user site repo for simplicity (or so I thought). they each worked in their own repos and had subdomains at my custom URL.

I’ll try updating to use relative urls and then removing the custom domain if needed.

Did you turn off the Pages feature on those old repos?

i did for droppin dimes not too long ago! but that didnt seem to do the trick. i just did the same for the-strays and removed the DNS records as well

I’m pretty sure the problem is the presence of the droppin-dimes repository.

If you set a custom domain for a user or organization site, by default, the same custom domain will be used for all project sites owned by the same account.

See GH docs.

https://www.johnwmathena.com/droppin-dimes

Does that point to the droppin-dimes directory within the jmathena1.github.io repo, or does it point to your droppin-dimes repository?

well i did unpublish the droppin dimes repository and remove the custom DNS record, so I think it would point the jmathena1 directory at this point. i’m not sure how to confirm that. the other thing I’m noticing is the droppin-dimes page does not have a final / at the end of its URL like the-strays does, though im unsure if that’s significant. i also used the relative link functions to no avail

Look at the published URL in the bottom right corner. It conflicts with your new site.

If I were you I would clone the old repo locally, then delete the repo on GH.

1 Like

oh wow. yeah i think that’s spot on. let me work on that

that did it! many thanks @jmooring! it was a pleasure spending this Friday evening debugging with you

1 Like

That was a good learning experience.

1) If you create a GitHub repository for a personal GitHub Pages site…

https://github.com/user/user.github.io

2) And then configure that repository with a custom domain name…

3) And the published personal GitHub Pages site has a subdirectory named “foo”…

4) You will have a conflict if you have a repository named “foo”

https://github.com/user/foo

So, in your case, we could have renamed the droppin-dimes directory to dropping-dimes and it would have worked fine (no conflict).

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.