1

I'm building a single page website Omega subtheme on drupal 7. I've got a menu on top with 5 items which I want to link them with an other 5 nodes on the same page. Obviously we need anchors here.

Which way do you think is smarter to achieve this?

PS:No, I don't want to use Single Page Website module

2

We created the Single Page Site module, to incorporate one page websites into Drupal. This is an example of a website using it: http://starfisk.com

Some more details about this module (from its project page), which is available for both D7 and D8:

This module provides functionality to create a single page website.

It allows you to automatically create a single page from a menu. The module will render all the content from the links, that are configured in the menu, on one page. It will then override the menu links so that they refer to an anchor instead of a new page.

| improve this answer | |
  • Dag Fons, please review the edit I just applied to your answer, to make it look less like a link only answer. If you don't like my edit at all, just perform a rollback, OK – Pierre.Vriens Feb 5 '17 at 17:31
0

I think you could use the hook_menu and create custom menu entries for this. The hook has an options array where you can pass such values.

"options": An array of options to be passed to l() when generating a link from this menu item. Note that the "options" parameter has no effect on MENU_LOCAL_TASK, MENU_DEFAULT_LOCAL_TASK, and MENU_LOCAL_ACTION items.

Not tested, but i think you can pass a "fragement" to the hook_menu options array like: array('fragment' => 'idofanchor')

| improve this answer | |
  • After some hard thinking I came up with this painless and easy solution. I created two different view blocks of the same content type. One view uses only the node title field and I rewrite it's output using patterns to make a menu link <a href="[title]">[title]</a>. The other view of the same CT has the title and body fields. Once again I rewrite the title field output to add an id in it. <h2 id="[title]">[title]</h2> So every is set up and I just add nodes. The menu items on top of the page and the content on bottom are added automatically :) – Nim Feb 18 '13 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.