?
avatar BRoehling
BRoehling
27 Jun 2020

Steps to reproduce the issue

if I enter index.php?option=com_content&view=article&id=5#section1 into the URL field of my menu > menu item, save it and refresh my homepage,
I will see that joomla changed my URL code changes to http://www.aaa.de/aaa/aaa/index.php?option=com_content&view=article&id=5&Itemid=128#section1&Itemid=120
in the browser.

Expected result

http://www.aaa.de/aaa/aaa/index.php?option=com_content&view=article&=5&Itemid=120#section1

Actual result

http://www.aaa.de/aaa/aaa/index.php?option=com_content&view=article&id=5&Itemid=128#section1&Itemid=120

System information (as much as possible)

Joomla 3.9.19
Windows 10
Google Chrome

Additional comments

is seems to be a problem with the ascii code-table for once because I'm getting &amp instead of &
and secondly joomla adds a second Itemid to the url.

Is it a bug or can it be solved somehow?

avatar BRoehling BRoehling - open - 27 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jun 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Jun 2020
avatar BRoehling BRoehling - change - 27 Jun 2020
The description was changed
avatar BRoehling BRoehling - edited - 27 Jun 2020
avatar BRoehling BRoehling - change - 27 Jun 2020
The description was changed
avatar BRoehling BRoehling - edited - 27 Jun 2020
avatar Quy
Quy - comment - 16 Jul 2020

Where are you seeing the & to & conversion? This is the expected behavior when viewing the page source/markup.

avatar BRoehling
BRoehling - comment - 17 Jul 2020

Joomla 3.9.19 & 3.9.20 convert the URL Type string from http://www.aaa.de/aaa/aaa/index.php?option=com_content&view=article&=5&Itemid=120#section1 to http://www.aaa.de/aaa/aaa/index.php?option=com_content&view=article&id=5&Itemid=128#section1&Itemid=120 and that is not only in the source code inspector but also when I hover over the link on my homepage with a mouse.

Why I am using the URL Type? The answer is, to be able to scroll from my submenu link to a specific #anchor in my page. But it doesn't work with the 3.9.19 & 3.9.20 version/

avatar ReLater
ReLater - comment - 17 Jul 2020

The main issue here seems to be that the fragment #section1 is not at the end of the "converted" URL.

... #section1&Itemid=120

An Example with installed demo data "learning" in Joomla 3.9.21-dev:

  • SEO on, URL rewrite on.
  • Existing article with ID 5 (Title: "Authentication")
  • This article has already a menu item "Authentication" (ID 318). But that's not too relevant here.
  • When I create a menu item type URL with link

index.php?option=com_content&view=article&id=5#section1

  • The output of Joomla is

/using-joomla/extensions/plugins/authentication#section1&Itemid=615

  • The trailing itemid is the id of the newly created URL item type.
  • The fragment #section1 is not at the end.
avatar brianteeman
brianteeman - comment - 17 Jul 2020

if I enter index.php?option=com_content&view=article&id=5#section1 into the URL field of my menu > menu item, save it and refresh my homepage,

That is your mistake as that is not the url. The url includes the itemid.

Personally I would recommend using the SEF url instead as its much easier.

For example the SEF url is www.example.com/contact

So I make the new menu url /contact#map or www.example.com/contact#map

Works perfectly

avatar ReLater
ReLater - comment - 17 Jul 2020

Whwn I debug my example item above inside helper.php of mod_menu then I get

[15] => Joomla\CMS\Menu\MenuItem Object
        (
            [id] => 615
            [menutype] => mainmenu
            [title] => URLtesten
            [alias] => url
            [note] => 
            [route] => url
            [link] => index.php?option=com_content&view=article&id=5#section1
            [type] => url
            [level] => 1
            [language] => *
            [browserNav] => 0
            [access] => 1
            [params:protected] => {"menu-anchor_title":"","menu-anchor_css":"","menu-anchor_rel":"","menu_image":"","menu_image_css":"","menu_text":1,"menu_show":1,"pageheader_suffix_ghsvs":"","page_subheading_ghsvs":"","mega-menu-ul-class":"","mega-menu-li-class":""}
            [home] => 0
            [img] =>  
            [template_style_id] => 0
            [component_id] => 0
            [parent_id] => 1
            [component] => 
            [tree] => Array
                (
                    [0] => 615
                )

            [query] => Array
                (
                    [option] => com_content
                    [view] => article
                    [id] => 5#section1
                )

        )

Look at the [query] block. The [id] => 5#section1 looks weird somehow.

avatar BRoehling
BRoehling - comment - 17 Jul 2020

it should be

[id] => 5
[anchor] => section1

right?

avatar ReLater
ReLater - comment - 17 Jul 2020

it should be

[id] => 5
[fragment] => section1

or something like that. I don't know. I always use the recommendation of brianteeman with hidden article menu items if I don't want them in my front end menu.

But the fragment should be kept always at the end of the url if the url is rebuilt; somehow...

avatar brianteeman
brianteeman - comment - 17 Jul 2020

It makes no sense at all for you to be trying to build sef urls for this. Just do what I say and use the sefurl in the link

avatar BRoehling
BRoehling - comment - 17 Jul 2020

I'll try brianteeman's recommendation with the sefurl.

avatar Quy
Quy - comment - 17 Jul 2020

Closing per #29797 (comment)

avatar Quy Quy - close - 17 Jul 2020
avatar Quy Quy - change - 17 Jul 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-07-17 16:50:28
Closed_By Quy

Add a Comment

Login with GitHub to post a comment