I was using a snippet to grab the /folder/index content when a user goes to /folder (note: I want to grab /index specifically and not just the first random file in a folder). This no longer seems to be working for me. Has anybody else found a workaround for this?
Hi @Alex_B_Centrifuge. I’ve tested your code and it’s working fine on my site.
Where is it failing for you? Is it not retrieving the Index page and you are seeing just the 404: Page not found. text.
Or are you not seeing anything output?
Hi @g.davis
I’m not sure why you’d be getting a recursion error, but the above code works for me with one adjustment.
Since the capture, if empty, actually returns a space so the IF statement checking for a null value will not work.
To fix this, I strip the captured variable first (to remove any whitespace), like this:
Hopefully, that resolves your issue.
If not, double check you have a sub-page with the slug of /index (or whatever slug you are checking for).
And perhaps paste your code here so we can review it along with a URL where we can see this error if possible (or a screenshot).