Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Antimatter Theme - Modify Header Links

Started by Muut Archive 11 years ago · 11 replies · 442 views
11 years ago

On antimatter theme, when i create a folder into directory structure /user/pages, automatically it creates a link on top header.

So, the link it is by default routed to that folder.

But, what i have got to do if i want to modify top header links ? (i want and blog link that must forward to blog.mydomain.com)

11 years ago

Quickest way: open user/config/site.yaml and add at the bottom of it

YAML
menu:
  -
    url: 'http://test.com'
    text: test2
11 years ago

Hi Flavio, thank you really much for your help;
it worked immediately, but i would like to know how i can give an order to it (it's appearing at the right part, and i want to be between 03 and 05)

Thanks in advance

11 years ago

Due to how Antimatter is built, you cannot do this out of the box. You can of course edit the theme (maybe using Theme Inheritance http://learn.getgrav.org/themes/customization#theme-inheritance) and edit the partials/navigation.html.twig file.

You could just hardcode the navigation you want there, or do some fancy things like adding a url property in the yaml frontmatter of a page, and do <a href="{{ page.header.url ?: page.url }}"> in your customized template navigation twig.

In this way those pages with (for example) url: http://test.com will be redirected to the specified url.

11 years ago

An easier option would be to create a dummy page so you get the menu where you want it in the order you want, then set a redirect in your site.yaml file for that route.

11 years ago

Hi rhukster, thanks for your answer:
can you give me an example to accomplish that?

11 years ago

Actually in the 0.9.41 Grav release I added the ability to add a simple redirect in the page header, so:

TXT
title: Page Title
redirect: http://test.com
11 years ago

Nice, really nice, you are the best.... waiting for paid version of admin to give you a really nice support to this project, we love it!

11 years ago

Another question: there is a way to show the content of the link in the same theme without exiting from it ? (like the grav forum), maintaining the navigation bar on top

11 years ago

Well the redirect can also be an internal page if that's what you mean:

YAML
title: Page Title
redirect: /my/internal/page/route
11 years ago

no, no, i want to mantain the top navigation bar but with the content of another page, like the forum (same navigation bar like the website but forum content)
Schermata 2015-09-20 alle 20

11 years ago

What page though? A non-grav page? you want to pull it into the Grav site? The forum on this site is just a grav page that has some JS in it to pull display the forum. I guess you could have a Grav page with an iframe in it to load content from another URL, but you can't really just show something there wrapped in Grav.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1338 9 years ago
Archive · by Muut Archive, 9 years ago
2 927 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago