Trivial question to create an inactive menu entry?

I need to create a menu item entry, that doesn’t do anything. I feel, I had it working before, but cannot find the ‘proper’ solution again ;)

In ‘Source’ the parent menu item of a submenu is created with a link ‘javascript:void(0)’, which I understand does nothing (as desired). In order to have a submenu item also do nothing, I tried to enter the same mini script into the URL field of an ‘Offsite page’, but wasn’t able to succeed. Either the href remains empty, or when using quotes they will be carried over into the HTML code. In the example below the ‘Deutsch’ menu item should do nothing, but e.g. with the href empty the site reloads …

Bildschirmfoto 2020-07-10 um 17.06.29

Bildschirmfoto 2020-07-10 um 17.07.30

Is there a proper way of creating inactive menu items in Source ? Thanks for sharing your insights, cheers.

Hi @GKs - i think I must be misunderstanding something. What would be the point of it being there at all if it is doing nothing? Would there not be times that the user would need it to reset to Deutsch (e.g. if they were on the Japanese version). I think it is ok if the person selects Deutsch and the page reloads (if they are already on that page).

If I am completely missing the point let me know.

Yes, I should have given a reason for this ‘odd’ sounding question:

Up to now I created a multilingual website by using the S4S RWML stack suite, which allows to create a page with multiple language ‘blocks’ with the appropriate ones being served ‘on the fly’ by a PHP script depending on the current language setting. This works well, but in combination with other blog stacks, sometimes other php scripts, and for proper SEO descriptions, one runs into limitations using the ‘one page’ approach.

The other (maybe more typical) way to serve multilingual sites is to provide individual pages for each language needed. Following this approach it is relatively easy to split the project up into individual languages, all working on subfolder structures and having their own properly translated menu structure. Long story short, this is where the ‘do nothing’ menu entry would come in handy. If the user is e.g. already in the ‘English’ context, then clicking on ‘English’ menu entry doesn’t have to do anything, whereas the other entries switch to the other language context. In e.g. the German context, the ‘English’ menu entry provided within this subproject indeed switch switches to ‘English’.

Each language sub project has its own page and menu structure, and the switching between languages happens via the language menu. Each language has one menu entry pointing towards itself - this is the entry where a ‘do nothing’ would be perfect ;)

Admitted, if I leave the URL blank, the ‘worst’ thing to happen is an unnecessary reload of the page … but if that could be avoided by a ‘javascript:void(0)’ call, it would be even better.

Ok - that makes more sense :)

I don’t know of a way to achieve it. What you were trying with the offsite page would have been the only way I’d have suggested but it looks like it needs a proper url and won’t accept that javascript call.

Maybe others know of a workaround.

1 Like

Why would you need to show this? For an english page I have the word DEUTSCHE VERSION in the menu. For the german pages, I have the word ENGLISH VERSION in the menu. So I will not use a case where I see the word DEUTSCHE VERSION on an german page…

3 Likes

FIRST - and most important:
@Fuellemann, @habitualshaker: you are - of course - 100% correct ! Why adding a UI element, which serves no function … except for some misguided aesthetic argument ;) Even my explanation just shows how one can miss the solution by being too close and stuck in an earlier thinking. Thanks for helping me taking a step back and realize the obvious - it’s simply not needed, and possibly even confusing ;)

Second - and almost irrelevant now:
I found a technical solution to what I was looking for - simply adding the href a-tag to the page title in the left-hand page menu, e.g.

<a href=“JavaScript:void(0)” rel>Deutsch</a>

will do the trick … though no longer needed ;)

2 Likes