Custom module root URL page?

I know this question has been asked and answered, but I can’t find it in slack, forum or on in the docs. Is it possible to have a page at a custom modules root url i.e. I have a custom module name programs, it’s root url is /programs, is it possible to have content at that url? Right now I just get a 404.

This seems really basic. I’m thinking I must just be missing something. I remember that it wasn’t possible at some point.

Any clarification, tips, workarounds appreciated.

1 Like
2 Likes

Thanks you @Denis.l . I really need this. Any update on possible delivery?

Re-posting @vlad.z response last time this was asked for others if they find this thread:

Blockquote Hi @A3CS
There is no ability to set root as a module slug (it’s done for system modules: Pages, Page Folders and Blogs only).
There is a background feature in development called Advanced URL management . Once it’s delivered it will allow to set any urls to any modules and module items. But it requires to do some internal work on the CMS first.
So the only one thing I can suggest right now is to wait a couple of sprints till we release this feature.

2 Likes

I require this feature too, It’s a fundamental requirement for most of my sites.
The sooner this is developed the better for me. I’m afraid to start migrating any sites that use ‘Custom Modules’ until I can see the form that the ‘Advanced URL Management’ feature takes.

Any word on a delivery time for ‘Advanced URL management’ feature?
It was mentioned in treehouse meetings that it was due for delivery in Feb 2019 (ie. 6 months ago)

An alternative (and great) idea brought up by Adam Wilson (I’m not sure if Treepl team are looking to develop this) is to simply allow the ability to add content to the root URL from within the ‘Custom Module’. I guess this would be similar to how you can add content to a ‘Page Folder’.

Looks like the Advanced URL Management feature is in this spring http://prntscr.com/oz9qp8

1 Like

Note: Advanced URL Manager has been split into 2 Public Backlog items
Part 1:
https://treepl.co/public-backlog-state/scheduled/advanced-url-management-part-1
Part 2:
https://treepl.co/public-backlog-state/request/advanced-url-management-part-2

You now need to vote again, separately for part 2.

@Peter-Schmidt could you please link this forum post to the backlog request (4357) so the team have the info they need when reviewing.

I think this is already implemented and is customisable via the Page Folder layout logic.

By default, when accessing a folder URL, if that folder has no description content then any page found under that folder will be shown.
If multiple pages exist under the folder then the first page (alphabetically) will be used - but you can customise this logic via Liquid in the Page Folder layout. For example, you could specifically look for a page called “index”.

Unless I’m missing something from this request?
If so, it might need some more clarification.

1 Like

If it is, we could cancel the backlog request yes? Rather than waste Treepl Dev time looking into it?

@Eugene - Is this fully implemented? :slight_smile:

Hi Adam.
Sorry just needing this functionality now and just wanted to clarify… is this still the case?
Is there a way to show a specific page content when landing on a folder url?

Hi @James
Yes, you can control the logic in the Page Folder layout.
Currently, the logic looks for the first page (alphabetically) within the parent folder and displays it’s contents if the Folder’s description is empty.
But using Liquid you can make this logic whatever you need it to be and show any content.

So let’s say I have a folder named ‘Fruit’ containing 3 pages named: ‘Apples’, ‘Bananas’, ‘Oranges’. By default, a link to /fruit would take you to the Apples page (the first alphabetically listed page) because the default Page Folder layout is:

{% if this['description'] != "" %}    
    {{this['description']}}
{% else %}
    {% capture indexPage %}{% component type:"module", source:"Page", layout:"Page Detail", filterBy:"parentid", filterValue:"{{this.id}}", limit:"1" %}{% endcapture %}   
    {% if indexPage == "" %}    
        {% component type:"module", source:"Page", layout:"Page Detail", filterBy:"name", filterValue:"404" %}       
    {% else %}
        {{indexPage}}       
    {% endif %}  
{% endif %}

To make the /fruit link go to the Bananas page instead, I could use the code:

{% if this['description'] != "" %}    
    {{this['description']}}
{% else %}
    {% capture indexPage %}{% component type:"module", source:"Page", layout:"Page Detail", filterBy:"parentid", filterValue:"{{this.id}}", limit:"1" %}{% endcapture %}   
    {% if indexPage == "" %}    
        {% component type:"module", source:"Page", layout:"Page Detail", filterBy:"name", filterValue:"404" %}       
    {% else %}
        {% component type:"module", source:"Page", layout:"Page Detail", filterBy:"name", filterValue:"Bananas" %}      
    {% endif %}    
{% endif %}

But this isn’t a good option because the ‘Bananas’ page might get deleted or renamed in the future. So I know I need to add an elsif to check whether the ‘Banana’ page exists but my liquid skills aren’t good enough to know how to do this. How do I write this, or do you suggest a better way?

Since your ‘Banana’ page is the preferred page I’d check for this first and fallback to the first alphabetical page, and then fallback to the 404 page/message. So almost reversing what you have now.

{% if this['description'] != "" %}    
    {{this['description']}}
{% else %}
    {% capture indexPage %}{% component type:"module", source:"Page", layout:"Page Detail", filterBy:"name", filterValue:"Bananas", limit:"1" %}{% endcapture %}   
    {% if indexPage != "" %}    
        {{indexPage}}  
    {% else %}
        {% capture indexPageFallback %}{% component type:"module", source:"Page", layout:"Page Detail", filterBy:"parentid", filterValue:"{{this.id}}", limit:"1" %}{% endcapture %}
        {% if indexPageFallback != "" %}    
            {{indexPageFallback}}  
        {% else %}
            {% component type:"module", source:"Page", layout:"Page Detail", filterBy:"name", filterValue:"404" %}     
        {% endif %}
    {% endif %}    
{% endif %}

(not tested)

Note: for the final 404 page, you could just have a “Page not found” message/content, rather than creating a ‘fake’ 404 page. As this is not really a true 404 result.

Thanks Adam! much appreciated.

That makes good sense. Thanks @Adam.Wilson !