Redirect from inside a modular page


#1

I am trying to have a modular page inside an outer structure. (see below)
Within the modular page, I want to have navigation links pointing to parts of the page. This can be done with onpage_menu: true

However, I also want to have in the navigation links a pointer to the outer structure.

I tried to create a modular unit with redirect: home (I have tried a number of routes with no change). The link appears in the navigation bar, but clicking on the link just moves the view to that part of the page, not to a different page.

I thought about this some more and I think that what I am trying will not work because what I want is for GRAV to replace the link in the navigation bar with the link for the outer page route, and GRAV does not do this.

So, is there a better way to get a custom link in the navigation bar in a modular page?


pages/

  • 01.start/
    • default.md
  • 02.system/
    • _part1/
      • default.md [this works because I have added default template to mytheme:// templates/modular/]
    • _part2/
      • default.md
    • _part3/
      • default.md [contains redirect: start in header]
    • modular.md [contains onpage_menu: true]
  • 03.otherstuff/
    • default.md

#2

It depends on how this menu is generated?
Is it from a Grav theme?


#3

I did not entirely understand your question.

I have cloned Antimatter and created my own theme with fairly minor alterations. For example, I have added a minimal templates/modular/defaut.html.twig.

The structure I posted was for user/pages, not user/themes//pages. I do not recall ever seeing a pages structure under a theme.

The menu is generated by template/partials/navigation.html.twig in Antimater.


#4

There is another problem associated with modular pages!!!

To deal with the situation above, I have been altering templates/modular.html.twig. But …

At the top of templates/modular.html.twig in Antimatter, the single page navigation plugin is initialised, but it doesn’t allow for external links. So if I try to go to a link outside the modular page, the link is disallowed.

This behaviour is limited to links inside <div id="navbar" >.

How can I overide this?

Solved:
In the relevant link, add the external class. Then Single page does not ignore it.
<a class="external" href="<some outer path>">Uplink</a>