Skip to content

feat(nav): set a CMS menu link to open in new tab - via setting#1150

Draft
wesleyboar wants to merge 1 commit into
mainfrom
fix/WP-1230-allow-forcing-cms-menu-link-to-open-in-new-tab
Draft

feat(nav): set a CMS menu link to open in new tab - via setting#1150
wesleyboar wants to merge 1 commit into
mainfrom
fix/WP-1230-allow-forcing-cms-menu-link-to-open-in-new-tab

Conversation

@wesleyboar
Copy link
Copy Markdown
Member

@wesleyboar wesleyboar commented Apr 22, 2026

Overview

Let us configure specific CMS menu links to open in a new tab.

Usage requires:

  • both by new setting (set via CMS dev)
  • and Page "ID" (set via CMS admin)

Previously, only external links got target="_blank".

Caution

Alternatives exist:

Related

Changes

  • added NewTabModifier in taccsite_cms/cms_menus.py
    • reads setting PORTAL_CMS_MENU_NEW_TAB_PAGE_IDS
    • adds node attribute new_tab
  • added setting PORTAL_CMS_MENU_NEW_TAB_PAGE_IDS
  • updated template tag target_blank to honor attr['new_tab']
  • updated cms_menu.html
  • updated settings_custom.example.py

Testing

  1. In CMS admin, set a page's reverse_id (Page > Settings > Advanced > "Id").
  2. Add that slug to PORTAL_CMS_MENU_NEW_TAB_PAGE_IDS in settings_custom.py and restart.
  3. Verify that nav link opens in a new tab; other internal links do not.
  4. Verify external redirect links still open in a new tab (existing behavior).

UI

Warning

Untested.


Made with Cursor. Directed and scrutinized by @wesleyboar.

Add PORTAL_CMS_MENU_NEW_TAB_PAGE_IDS setting and a NewTabModifier
(cms_menus.py) that annotates matching menu nodes via reverse_id.
Extend target_blank tag to accept an optional menu node and honor
the annotation, keeping template calls clean.

Made-with: Cursor
@wesleyboar wesleyboar added the alternative Alternative solution(s) exist(s) label Apr 22, 2026
@wesleyboar wesleyboar changed the title feat(nav): allow CMS menu links to open in a new tab feat(nav): let CMS menu links open in new tab - settings Apr 22, 2026
@wesleyboar wesleyboar changed the title feat(nav): let CMS menu links open in new tab - settings feat(nav): set CMS menu link open in new tab - settings Apr 22, 2026
@wesleyboar wesleyboar changed the title feat(nav): set CMS menu link open in new tab - settings feat(nav): set a CMS menu link to open in new tab - via settings Apr 22, 2026
@wesleyboar wesleyboar changed the title feat(nav): set a CMS menu link to open in new tab - via settings feat(nav): set a CMS menu link to open in new tab - via setting Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alternative Alternative solution(s) exist(s)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant