hyphacoop / api.distributed.press

https://distributed.press
GNU Affero General Public License v3.0
77 stars 8 forks source link

Nextra Folder Structure isn't served properly #51

Closed jackyzha0 closed 1 year ago

jackyzha0 commented 1 year ago

Nextra supports having index pages for folders. However, the structure they use is slightly different from most sites. Instead of having folder/index.md, Nextra forces you to name it folder.md

See more: https://nextra.site/docs/docs-theme/page-configuration#folders-with-index-page

I suspect this may be due to the NGINX config. This causes URLs like https://docs.distributed.press/deployment to fail to load even though the files are present (https://github.com/hyphacoop/docs.distributed.press/blob/main/pages/deployment.mdx)

RangerMauve commented 1 year ago

This is the line responsible for the "resolution ordering" in nginx.

https://github.com/hyphacoop/api.distributed.press/blob/main/ansible/roles/distributed_press/templates/nginx-static.j2#L13

try_files $uri $uri/ $uri.html $uri.md $uri.gmi $uri.gemini =404;

We could change the ordering here. One thing however is that we should check what ordering IPFS gateways perform and stick to that. I have a feeling they check for directory names before file names.

https://docs-distributed-press.ipns.ipfs.hypha.coop/deployment/

At the very least ours (which uses go-ipfs) does.

I think this fix will need a change in the docs, ideally by moving deployment.mdx intodeployment/index.mdx` or similar.

jackyzha0 commented 1 year ago

Just fixed this in docs, this is an unlikely folder/file structure so going to mark as wont-fix