McShelby / hugo-theme-relearn

A theme for Hugo designed for documentation
https://mcshelby.github.io/hugo-theme-relearn/
MIT License
379 stars 178 forks source link

My site is rendering all over the place, has there been a breaking change? #781

Closed hvddrift closed 6 months ago

hvddrift commented 6 months ago

For example, I made a new site with one page it is doing this:

image

`--- title: "PITT Tech Info" description: "Your go-to resource for in-depth technical details on PITT Cooking products." archetype: "home"

PITT Cooking Banner Image

Welcome to PITT Cooking Technical Resource

This site is dedicated to providing installers, designers, and other professionals with comprehensive technical information about PITT Cooking products. Dive deep into the intricacies of our offerings, from installation guides to detailed product specifications.

"In every PITT Cooking design, form meets function with elegance and precision."

Contact Us

cagix commented 6 months ago

@hvddrift I've also experienced this problem several times - deleting the entire browser history including cookies etc. did the trick for me.

McShelby commented 6 months ago

has there been a breaking change?

Impossible to say as you have not given both your previous and current versions of Hugo and the theme.

Also a repo or URL is necessary if this issue persists.

McShelby commented 6 months ago

https://discourse.gohugo.io/t/everything-on-level-1-renders-but-now-any-sub-pages-are-giving-a-404/48525

Your URL is https://www.pittcooking.info/

Looks spiffy to me.

grafik

Anyway, I wouldn't be too suprised if the site is broken somewhat, as you are using the newest Hugo version but not the newest theme release. Your used theme version 5.21.0 is not compatible with your Hugo version 0.123.2.

See https://mcshelby.github.io/hugo-theme-relearn/basics/migration/index.html

hvddrift commented 6 months ago

I have not pushed the updated site. I am afraid of it breaking.

The fist issue I found was as per the published site: https://www.pittcooking.info/collection/1-burner/air/index.html All the sub pages now give a 404

So I tried to update the theme (are there migation instructions somewhere? Or is it as simple as cloning the theme into the themes folder?)

When serve it localy I get the bad render. (Tried on Edge also, same issue)

image

I tried clearing all browser and cache history.

I even tried a new test site. Have the same issue.

So, my issue is now that it does not render correctly and the sub pages are not working either.

McShelby commented 6 months ago

I'll take a look into it.

Migration infos are given on the above linked page in the docs.

hvddrift commented 6 months ago

Thank you. Am I able to possible donate or do you have a buy me a ??? page. Your theme is fantastic.

McShelby commented 6 months ago

Thank you. Am I able to possible donate or do you have a buy me a ??? page. Your theme is fantastic.

Thanks for the praise. I am just fine if you would give it a star.

FYI, I added you as a collaborator to my git, you may see what I have done wrong there

I've already cloned and can reproduce your issue.

McShelby commented 6 months ago

You are overloading the whole header.html. If you remove it, the page shows fine. What was the intention to overload it? While it is possible to do this, there might be better solutions depending on your use case.

If you still want to overload this file, you are in the responsiblity to sync your changes with the latest version of the themes header.html after updating.

The same goes for the render-image.html hook.

McShelby commented 6 months ago

I found two immediate issues:

  1. The authorname.hugo causes a crash. Immediate fix is to remove line 8 from the file. I'll come up for an official fix tomorrow. #785
  2. As pointed out in the previous comment:
    • remove your own 'header.html'
    • create a file custom-header.html in the same location as your now removed header.html and add
      <link rel="stylesheet" href="/css/styles.css">

Bonus: I think you can remove your `render-image.html'. The theme provides the same visuals out of the box - using a different technique (in comparison to your solution, the image url is now as easily copyable)

hvddrift commented 6 months ago

I made the changes locally. TBH I cannot remember ever changing the header.html

It has fixed most of the pages. But /post-install/ /installation/ /pre-install/

Which I had to change to index.md from _index.md as it had errors. ?? Leaf Bundle.

The content pages are still not working. Have a 404 on everthing from below the collection.

hvddrift commented 6 months ago

Migration infos are given on the above linked page in the docs.

I looked at this page https://mcshelby.github.io/hugo-theme-relearn/basics/migration/index.html But unless I am missing something, it only shows changes, not instructions on how to upgrade.

McShelby commented 6 months ago

The author advise is given for 5.23.0.

The attachment issue is not related to the theme but to your used Hugo version. These hint is written when executing hugo server on the commandline.

Regarding the 404, I'll have to dig into it tomorrow.

I'm pretty sure, we can fix this all ;-)

hvddrift commented 6 months ago

Seeing if you had a chance to find the error. Anything I can do to help solve the issue?

McShelby commented 6 months ago

Some updates - good and bad:

I've fixed everything but the 404. The 404s are a bit puzzling. I went back in your repo to Oct 3rd 2023 and used Hugo 0.119.0. Also this combination did not render the pages below content/collections/*. The frontmatter looks okay to me and Hugos docs do mention the use case.

The only difference is, that they are using page bundles instead of simple pages (so instead of `content/collections/1-burner/air.md' they are using 'content/collections/1-burner/air/_index.md'). It worked for me when I changed to this structure.

So two questions here:

  1. Does this only work with bundles? (a question the Hugo guys should have an answer to)
  2. Are you sure this worked for you in the first place? If so: Which Hugo version, which theme version, which commit in your repo?

If you are interested I can make a PR with my changes - each fix its own commit

hvddrift commented 6 months ago

It did work well for a long time, I had not updated Hugo or the theme, and I attempted to edit one of these sub pages. When I pushed the update there were no changes at pittcooking.info

I thought it was an issue with render.com (i assumed they use a later version of Hugo)

That's when I started to update my Hugo and your theme.

Re "Does it only work with bundles" I am not sure about this (my skill level is quite low, combo of help pages and ChatGPT got me this far)

From my perspective I did not change any of the pages below content/collections/* something has caused this however.

Happy to get any workaround you suggest. I am just getting calls from my customers saying the pages don't work.

McShelby commented 6 months ago

Okay. I will push directly to your repo in a separate branch. After that you have a few things left to do:

  1. Fix the remaining pages below collections as shown in my last commit for air.md named structure: sample fix for 404, needs to be applied to all collection subsubpages
  2. Update to the latest theme version 5.24.3 (fresh from the oven)
  3. Fix the last broken link warning by adding the missing file:
    WARN  "C:\\Daten\\Soren\\git\\pittcookingtechnical\\content\\collection\\5-burners\\ebeko.md": link '/pdfs/PITT-cooking-Techn.-Document-Ebeko-NL-EN.pdf' is not a page but linked anyways
McShelby commented 6 months ago

Branch pushed named relearn-5.24

McShelby commented 6 months ago

By the way: Well done site with impressive amount of content. I really like it!

Not so serious proposal: Name the next burner Shelby ;-)

Back to work - my kitchen now needs a makeover

McShelby commented 6 months ago

Darn. something's still off. Please ignore/revert the commit attachments: switch to leaf bundles. It will not generate the renamed pages.

Once reverted, a warning will be written to the console but you can ignore it as the pages are generated correctly and the attachment links also work.

Seems, something has changed in Hugo 0.123.

hvddrift commented 6 months ago

Not so serious proposal: Name the next burner Shelby ;-)

We have an interesting naming convention. 1 burners start with the 1st letter (eg A Azuma, Air etc) 2 burners, 2nd letter, Bromo, Baula etc. So for a Shelby you are looking for a 19 burner :)

Also they are all named after volcanos. GPT say's

"No, there are no volcanoes named Shelby on planet Earth. Volcano names often derive from geographical locations, nearby landmarks, indigenous names, or historical figures relevant to the area where the volcano is located, and "Shelby" does not match the naming conventions typically used for volcanoes."

hvddrift commented 6 months ago

Okay. I will push directly to your repo in a separate branch. After that you have a few things left to do:

  1. Fix the remaining pages below collections as shown in my last commit for air.md named structure: sample fix for 404, needs to be applied to all collection subsubpages
  2. Update to the latest theme version 5.24.3 (fresh from the oven)
  3. Fix the last broken link warning by adding the missing file:
    WARN  "C:\\Daten\\Soren\\git\\pittcookingtechnical\\content\\collection\\5-burners\\ebeko.md": link '/pdfs/PITT-cooking-Techn.-Document-Ebeko-NL-EN.pdf' is not a page but linked anyways

Update to the latest theme version 5.24.3 (fresh from the oven)

Sorry to ask this (it just confuses me) but does the Branch have the latest Relearn 5.24.3 already in it? If yes, If I merge (if it all works well) into the master do I still need to do this?

hvddrift commented 6 months ago

I updated the theme to theme version 5.24.3 (i removed the old theme and replaced it with the 5.24.3)

and.... image

hvddrift commented 6 months ago

But this branch relearn-5.24 works good so far. Testing

hvddrift commented 6 months ago

Published to pittcooking.info relearn-5.24 and so far so good

this is from render.com

==> Cloning from https://github.com/hvddrift/pittcookingtechnical ==> Checking out commit 6fbf3aa251a612f58bd3d2b0e92a44dbd1469efe in branch master ==> Downloading cache... ==> Transferred 91MB in 8s. Extraction took 3s. ==> Using Node version 14.17.0 (default) ==> Docs on specifying a Node version: https://render.com/docs/node-version ==> Using Ruby version 2.6.8 (default) ==> Docs on specifying a Ruby version: https://render.com/docs/ruby-version ==> Using Python version 3.7.10 (default) ==> Docs on specifying a Python version: https://render.com/docs/python-version ==> Using Poetry version 1.1.14 (default) ==> Docs on specifying a Poetry version: https://render.com/docs/poetry-version ==> Installing Poetry version 1.1.14 Retrieving Poetry metadata

Welcome to Poetry!

This will download and install the latest version of Poetry, a dependency and package manager for Python. It will add the poetry command to Poetry's bin directory, located at: /opt/render/project/poetry/bin You can uninstall at any time by executing this script with the --uninstall option, and these changes will be reverted. Installing Poetry (1.1.14) Installing Poetry (1.1.14): Creating environment Installing Poetry (1.1.14): Installing Poetry Installing Poetry (1.1.14): Creating script Installing Poetry (1.1.14): Done Poetry (1.1.14) is installed now. Great! To get started you need Poetry's bin directory (/opt/render/project/poetry/bin) in your PATH environment variable. Add export PATH="/opt/render/project/poetry/bin:$PATH" to your shell configuration file. Alternatively, you can call Poetry explicitly with /opt/render/project/poetry/bin/poetry. You can test that everything is set up by executing: poetry --version ==> Running build command 'hugo --gc --minify'... Start building sites … hugo v0.123.2-929b91fe75cb0d041f22b4707700dfc117115ad4+extended linux/amd64 BuildDate=2024-02-22T15:27:15Z VendorInfo=gohugoio | EN
-------------------+------ Pages | 73
Paginator pages | 0
Non-page files | 327
Static files | 204
Processed images | 0
Aliases | 1
Cleaned | 0
Total in 5054 ms ==> Uploading build... ==> Your site is live 🎉

McShelby commented 6 months ago

Looks a bit better. You still have to do (all mentioned somewhere above):

  1. Update to the latest theme version 5.24.3 (fresh from the oven) (I have not pushed this as I used a different version for testing)

  2. Please ignore/revert the commit attachments: switch to leaf bundles. It will not generate the renamed pages.

I will come up with a permanent solution for the attachments shortcode with the next theme release.

hvddrift commented 6 months ago

When I tried to upgrade to 5.24.3 the rendering went like the above image again. Not sure why. I made a branch "5.24.3" did Hugo Serve, and it just did not work. Again, not sure if I upgraded correctly. I deleted the old theme, and just replaced it. Not sure if I am doing something wrong here.

So, those 3 pages, revert back to _index.md and put the pdf's in their folder?

McShelby commented 6 months ago

Forget any previous comments.

Starting from your latest master branch, I've pushed to a new branch `theme-update-5.25.0'. This requires Relearn 5.25.0

This fixes:

  1. Deleted superflous files under content/*/index.files/*. Those are already contained in content/*/
  2. Added your two new PDFs for outdoor and ebeko. PUT YOUR PDFs INTO assets/pdfs/ NOT INTO public/
  3. Migrated to new (in Relearn 5.25.0) shortcode resources from attachments and fixed structure.
  4. Moved the logos back to static directory from assets (error introduced in one of my previous changes)

YOU NEED TO UPDATE themes/hugo-theme-relearn TO THE LATEST RELEASE 5.25.0 YOURSELF!

Don't edit public/ manually. This is the location where Hugo generates its files into. Honestly, I don't know why they are included in your repo. These shouldn't.

hvddrift commented 6 months ago

Firstly, thank you.

Steps I took.

  1. Removed the current theme (deleted it)
  2. Downloaded https://github.com/McShelby/hugo-theme-relearn/releases/tag/5.25.0 into the theme folder
  3. extracted the folder and renamed it hugo-theme-relearn
  4. Change the line to theme = "hugo-theme-relearn" from theme = "../../../hugo-theme-relearn"
  5. run hugo serve

And all works great thank you

hvddrift commented 6 months ago

I just want to check something

I tried to amend pitt-card.html . ├── archetypes │ └── product.html ├── custom-header.html ├── logo.html ├── pitt-card.html ├── product-card.html └── shared_product_info.html

from

  <h4>Design & Installation</h4>
  <ul class="design-installation">
    <li><a href="{{ .installation_instructions }}">Installation and handling instructions (PDF)</a></li>
    <li><a href="{{ .installation_manual }}">Installation manual (PDF)</a></li>
  </ul>
  <h4>Design & Installation</h4>
  <ul class="design-installation">
    <li><a href="{{ .installation_instructions }}">Benchtop and Cabinetry procedures (PDF)</a></li>
    <li><a href="{{ .installation_manual }}">Installation manual (PDF)</a></li>
  </ul>

But the content page does not change/update. Am I missing something?

McShelby commented 6 months ago

It's not used.

hvddrift commented 6 months ago

As you can probally tell, and I appreciate your patience with me, I get a bit confused as I am novice. Wrote the site 6 months ago and am relearning relearn :)

Are you able to point me in the direction of where I would edit this item please?

hvddrift commented 6 months ago

Found it under shortcodes :)

McShelby commented 6 months ago

Hugo (and probably the theme aswell) suffer from a steep learning curve. For starters not acustomend to all of this it can be hard.

Luckily, the Hugo docs are improving a lot and the official discussion forum provide a lot of help. You should read some of the starter articles from the docs to get a better understanding of the basics.

To avoid such hassle in your future development, it can help to freeze your Hugo and theme version to a combination that works. The Hugo 0.123 release has major internal changes and can be seen as a kind of beta version. Updates are coming out sometimes on a daily basis.

Sadly, this can be experienced on your site, too. You have built the site with Hugo 0.123.2 which suffers from a bug in the resources handling. This causes some of your "Related Files" boxes in your Install pages to be empty. Hugo 0.123.6 fixes this but I would strongly advise to freeze your Hugo version to 0.122.0 for some time.

hvddrift commented 6 months ago

This is what happened just for your refrence.

I try not to update things. "If it isn't broke don't fix it" is my goto motto.

I just tried to add some content, a simple line and then it all went kaput on the render.com site. It killed all my content pages.

Thats when I tried to upgrade hugo and your theme.

Perhaps next time I should ask here first.

hvddrift commented 6 months ago

When I do hugo serve this works with your new shortcodes. But when it publishes on render.com it does not

image ## Control Knob Check {{% resources style="info" title="Related **files**" pattern="^Installation_TS_2021_AU_PC_1\.(pdf|mp4)$" /%}}

Can you suggest a work around?

https://www.pittcooking.info/post-install/index.html

McShelby commented 6 months ago

That's what I meant above: The Hugo version render.com is using is buggy. You have to check their docs how to explicitly set a version that works. Either 0.122.0 or 0.123.6

grafik

hvddrift commented 6 months ago

Would you look at that! image Thank you again. ended up writing a bash script and using verison 0.122.0

hvddrift commented 6 months ago

You are amazing. Thank you

McShelby commented 6 months ago

Thanks man. Glad I could help.

McShelby commented 6 months ago

Thank you. Am I able to possible donate or do you have a buy me a ??? page. Your theme is fantastic.

@hvddrift Don't feel pressured: because you (and some other guys in the past) have asked, I set up a sponsoring page.

Regardless of donations, feel free to ask here whenever something seems to be broken. I am glad to help.