gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.73k stars 7.45k forks source link

Prevent panic when creating new content if also created by content adapter #12504

Open jmooring opened 4 months ago

jmooring commented 4 months ago

These are all minor, and should probably be separated into individual issues at some point, but for now...

1) If a content adapter creates p1, attempting to create p1.md with hugo new causes a panic.

2) If p1.md exists, and a content adapter creates p1, the content adapter wins. It seems to me it should be the other way around; p1.md should override the content adapter. For example, a module provides content, and you need to override one of the pages provided by the module. See comments below.

3) If p1.md exists, and a content adapter creates p1, the --printPathWarnings flag does not report a page collision. See comments below.

bep commented 4 months ago

2) The behaviour here is undefined; if you see a winner here, that is by chance. We sort the directories before we process them, but p1.md and _content.gotmpl is processed in separate Go routines, so who's the winner of p1.md and p1 from some _content.gotmpl is undefined. 3) I think there's an existing issue for this.

jmooring commented 4 months ago

if you see a winner here, that is by chance

Understood. I have added a "page collisions" section to the documentation: https://gohugo.io/content-management/content-adapters/#page-collisions