+1

Question about / feature request for more configurable autonav block

Brad Bautista 2 weeks ago in BLOX CMS • updated by Maureen Reinert 5 days ago 6

Here's my quandary: 


We're trying to make our calendar utilization more robust, in part by making calendar categories more easily navigable and by hiding some of the breadth of the calendar categories from users by curating the presentation of certain categories.


To that end, I'd like to use an autonav block to direct users to specific calendar pages, though not necessarily all the subcategories of /calendar/, and possibly even to pages outside the /calendar/ directory.


So, to wit: One of the requested features was a page where users can see text listings of a large number of upcoming events — say for the next month. If I create an associated URL (/upcoming_events/) in the /calendar/ directory, it will show up in the autonav block configured to call /calendar/, but it will also show up in the user submission form for calendar events on the dashboard. I don't want users to be able to submit an event as an upcoming event, but I do want them to be able to utilize the autonav to navigate to /upcoming_events/. If I create /upcoming_events/ outside the /calendar/ directory, it will not appear in the dashboard submission form, but it will also not appear in the autonav.


Similarly, we would like users to be able to make submissions under certain categories that are not necessarily presented to all users in the autonav. This is because we have a number of calendar categories which are not extensively populated (dance, car shows) but could be presented together in a broader category (say, entertainment). If /dance/ and /car_shows/ exist under /calendar/, they'll appear in the dashboard submission form, but also in the autonav. We do not want this because we'd rather direct users to fewer, more populated pages instead of many sparsely populated pages. I can use a card block to pull in /dance/ and /car_shows/ submissions to an /entertainment/ page, but the /entertainment/ page will not show up in the autonav unless it is also under /calendar/ — and thus it will show up in the dashboard submission form, which we do not want because "Entertainment" is a broad enough designation that it becomes meaningless unless curated on the front end.


If I've got it right, this is because the autonav and the dashboard submission form both call /calendar/. After racking my brain, the most efficient solution I can think of for this is a block that looks and functions (for the user) like the autonav, but which can be configured in the CMS to display only selected directories. Is there a block that does this? Is it possible? Am I missing an obvious answer?


Any insights are appreciated.


Brad Bautista

Citrus County Chronicle

I think it's pretty easy to take care of  your first scenario, where you want upcoming events in the autonav but not in the user dashboard  If you create the upcoming_events page, you should be able to go into the Page customizations Under Misc and turn off Allow user submitted content. That should keep that section/page out of the user dashboard, but it will still appear in the autonav.

For your second scenario, where you want to keep certain pages/sections out of the autonav, you're going to need to create a custom block in the templates.


Basically, what we was make a copy of the existing Utility: Autonav block. To exclude certain pages from the autonav, we put a keyword in the URL Page properties for each of those pages (in our case "Redirect"). Then in our custom block code, we check for that keyword. If that keyword doesn't exist, show the URL.


[%- foreach oBaseUrl.children as oLink -%]
        [%- pKeywords = oLink.keywords; -%]
        [% if !((pKeywords | contains ('Redirect')) || (pKeywords | contains ('redirect'))); -%]
            [% if oLink.url != oBaseUrl; %]
                [%- sTitle = util_ternary(oLink.label, oLink.title) | html -%]
                <a class="list-group-item[% if oLink.url == this.url %] active[% end %]" href="[% oLink.url | html %]" title="[% sTitle %]">[% sTitle %]</a>
            [%- end; -%]
        [%- end; -%]
        [%- end; -%]


If you need help with any of this, let me know.

Thank you! The first solution is simple enough, but I'll follow up if I run into trouble creating the custom block. Thanks again.


-brad

Maureen,

I do not see any way to create a custom block under Design / Templates. I can view what's there and export, but not create or import. After consulting the KB, I assume this is because I do not have template access. I just want to confirm this is the case before proceeding with requesting it.


Best,


-brad

You would need to have template access in order to create a block.

Hi Maureen,

Just wanted to follow up to say it's working and perfectly. Thanks again!


-brad