backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Menu item text replaces page title #1648

Open maxmeno opened 8 years ago

maxmeno commented 8 years ago

I'm working at porting a 2011 Drupal 6 website (sailing event) to Backdrop.

After creating two results pages and adding them to the main menu, I decided that the menu items text was too long and I made it shorter. After that, the shorter menu text got inserted as page title.

If I edit the node, the correct title is there. After saving it, it's replaced by the corresponding menu text. See screengrabs.

If I reopen, the correct text is there. Save, gone.

editing-correct_title saved-text_replaced

maxmeno commented 8 years ago

p.s. - If I edit the node, clear the "Provide a menu link" field, save, the correct title is displayed. But if I then add the node link to the menu, the link text replaces the title again.

maxmeno commented 8 years ago

I have no idea about how and why, but this appears to be related to layouts implementation.

I was trying to use an existing layout (no sidebars) with a new content type. I added a new visibility condition, instead of modifying the existing one to add the second content type for node. Results: 1) the layout was not applied, not even to the older content type that had been using it but 2) the correct page title was shown for all nodes.

I then modified the layout settings, deleting the second visibility condition and configuring the pre-existing one to be Node is one of "Photogalleries, Results" and now 1) the correct layout is applied to both content types 2) page title is replaced by the shorter link text.

Does this help?

klonos commented 8 years ago

This is an intriguing one...

I can help troubleshoot this, but I'm afraid I will have time next weekend. I would have to replicate your specific use case.

  1. Would have to set up a basic D6 test site.
  2. Create the same or similar nodes as the "results" nodes you mention. I would need your input here as to what field types you had created. It seems that it is only title and body with WYSIWYG enabled for the body in order to have tables.
  3. Your issue seems to be related to menus as well, so I would need to create a menu and have "results" nodes use it.
  4. Upgrade the D6 site to Backdrop (was it 1.3.2 you used? did you do an in-place upgrade? which contrib modules did you use on the D6 site prior to the upgrade? which Backdrop contrib modules are you using after the upgrade?).
  5. Test this scenario and see if I can reproduce:

    If I edit the node, clear the "Provide a menu link" field, save, the correct title is displayed. But if I then add the node link to the menu, the link text replaces the title again.

  6. Test this scenario and see if I can reproduce:

    I was trying to use an existing layout (no sidebars) with a new content type. I added a new visibility condition, instead of modifying the existing one to add the second content type for node. Results: 1) the layout was not applied, not even to the older content type that had been using it but 2) the correct page title was shown for all nodes.

  7. Test this scenario and see if I can reproduce:

    I then modified the layout settings, deleting the second visibility condition and configuring the pre-existing one to be Node is one of "Photogalleries, Results" and now 1) the correct layout is applied to both content types 2) page title is replaced by the shorter link text.

Does that seem like about right or am I missing any important steps?

maxmeno commented 8 years ago

This is an intriguing one...

I know - and I can't believe none of the existing BD sites run into it so far.

I can help troubleshoot this, but I'm afraid I will have time next weekend. I would have to replicate your specific use case.

Would have to set up a basic D6 test site. […]

It will be a lot easier than that. We are talking about a clean, up-to-date Backdrop install. I'm rebuilding this small D6 website (35 some nodes) to get rid of some original mistakes and clean up the file structure.

It seems that it is only title and body with WYSIWYG enabled for the body in order to have tables.

You're right, but I'm not even using CKeditor for this: I'm pasting the original tables (created in Drupal with table filter) in HTML source, after cleaning up the structure with some search & replace with a text editor.

Your issue seems to be related to menus as well, so I would need to create a menu and have "results" nodes use it.

The same menu is shared by both layouts - and everything is normal for basic pages (one sidebar, default layout) added to the menu.

... Which Backdrop contrib modules are you using? ….

Here is the list of active modules:

Administration bar 1.3.3 Contextual Links 1.3.3 Color 1.3.3 Taxonomy 1.3.3 Configuration manager 1.3.3 Database Logging 1.3.3 Syslog 1.3.3 Update Manager 1.3.3 Date 1.3.3 Email 1.3.3 Field UI 1.3.3 File 1.3.3 Image 1.3.3 Link 1.3.3 List 1.3.3 Number 1.3.3 Options 1.3.3 Social field 1.x-1.4.1 FlexSlider 1.x-2.0.0 FlexSlider Fields 1.x-2.0.0 Pathologic 1.x-1.0.3 Block 1.3.3 IMCE 1.x-1.0.0 Backup and Migrate 1.x-1.0.5 Google Fonts 1.x-2.1.0 Nice Menus 1.x-1.0.0 Redirect 1.x-1.0.4 Global Redirect 1.x-1.5.0 Search 1.3.3 Base Meta: Page Title And Meta Tags 1.x-1.1.1 ShareThis 1.x-1.2.1 Menu 1.3.3 Path 1.3.3 CKEditor 1.3.3 Views UI 1.3.3

Installed but non active, yet: Responsive Menus 1.x-1.1.3

I'm more and more convinced that both layout and menu are at work here, because as I said the problem does not happen with the one sidebar layout for basic pages - and it was gone when the alternative layout was not being applied.

(The alternative layout is the one column one shipped with core, nothing fancy.)

Not sure if it means anything but when I originally created this alternative content type I did not pick any of the available menus. This is a step you could copy while trying to reproduce the issue.

Graham-72 commented 8 years ago

@maxmeno my suggestion is that you have a look at what the template files are doing because it sounds as if the alternative layout is interpreting your page differently (or perhaps incompletely). I recently added a Radix layout to part of a site that is mainly using Bartik layouts and this caused many issues because of different id and class names.

maxmeno commented 8 years ago

Thanks - this could explain why I'm having problems with a different layout I would need for the homepage.

I'll check the template files, even if they are the ones that ship with BD core.

Graham-72 commented 8 years ago

Another place where I have had difficulty is the configure block menu for the header block - see screenshot below. Sometimes I have even forgotten where to find these important settings. Probably not what is causing your problem but worth a thought. I hope you soon find the answer. default layout - backdrop starter 2016-03-19 13-06-24

maxmeno commented 8 years ago

I had a look at the one_column layout in core. It seems to me that Regions are listed correctly. There is no specific template file in that folder. This is from the .info file:

Note that the 1 column layout uses the layout.tpl.php file provided by Layout module, and so it does not provide a tpl.php file itself. To override this layout's template, copy it from core/modules/layout/templates/layout.tpl.php.

So I got that file, copied it to the one_column folder and renamed it layout--one-column.tpl.php Nothing changed.

Graham-72 commented 8 years ago

@maxmeno you are probably doing this yourself, but if I was in your situation I would be using 'inspect element' (Firefox) or 'inspect' (Chrome) to see what exactly is reaching the browser. There must surely be some clue in there. Forgive me if I am telling you obvious things.

maxmeno commented 8 years ago

don't worry, Graham, you're not…. ;-)

inspect-wrong_title Can you see anything wrong?

Title should be Techno 293 Europeans 2011 - Under 17 girls, while results - U17 girls is the menu text.

Graham-72 commented 8 years ago

Thanks for posting this. I have checked it against a similar piece of HTML from a 1 column layout site I have (below) and it seems to be a little bit different around id="page-title". I will get back to you in a little while. chcode

Graham-72 commented 8 years ago

@maxmeno I have done another test to see if I can creat a page with your long title then reduce its menu to a short title, using the one-column layout, and all works as it should at the moment. The long title appears at the head of the page, and the shortened version appears in the menu. But I still get <h1 id="page-title" - perhaps someone else can tell us where this is coming because I haven't yet found it in core.

quicksketch commented 8 years ago

Hi @maxmeno! Thanks for filling this bug report!

I also couldn't reproduce the issue. I've got a general idea of how your site is set up, but a true step-by-step would be useful. Here's what I tried:

If there's a step I missed in here, could you elaborate on reproducing?

But I still get <h1 id="page-title" - perhaps someone else can tell us where this is coming because I haven't yet found it in core.

In an early version of Backdrop (1.1 I think?) we switched from id="page-title" to class="page-title". If you still have id="page-title" instead of class of the same name, it may be your theme (or custom layout) has a template that is still using id instead of class.

maxmeno commented 8 years ago

If there's a step I missed in here, could you elaborate on reproducing?

you got almost everything right, @quicksketch:

Fresh install of Backdrop.

Bartik theme. I created a new type of content ("results") planning to use the full page width, with the one column layout include in Core. At this point I did not link the new type of content to a specific menu.

Created a new Page node with the title A page with a long title. Checked the box for Provide a menu link. Saved the node. Menu link appears in the primary navigation with the long title.

well, the menu text wasn't the page title, too long, it was something in between. But after I went to edit it and saved, I noticed for the first time that the new short text was also used in place of the H1 on the page. I guess the "shortening" was not what actually triggered this bug, but I can't be sure.

Later I also switched from the default menu (not dropdown) to* Nice menus* module.

That ID/class hint could be the key, but to follow it would take me more time than you guys. I will check a few ideas later today.

maxmeno commented 8 years ago

Following up…

1) the <h1 id="page-title" class="title"> snippet is from @Graham-72's installation, not mine. I have <h1 class="page-title"> and it shouldn't be any conflict there.

2) nice_menu is not the culprit - I disabled the module, flushed cache a couple of times, edited and saved one of the nodes, and the problem is still there.

3) To confirm: if I open the node, uncheck "Provide a menu link", save, the correct H1 title comes back.

4) If I open the node again and check "Provide a menu link", the current page title is picked as menu link title. Is it Core doing this? Or the menu module? Which function would pass along the menu text as an H1 title?

Short of ideas, here….

Graham-72 commented 8 years ago

Yes, the <h1 id="page-title" is from an 'old' template in my site, as @quicksketch says. Apologies for the red herring.

Graham-72 commented 8 years ago

Well, menu.module in core does things with titles, but I don't really know anything about its workings. And why should it behave differently for different templates? The answer will no doubt be obvious once we find it!

jenlampton commented 7 years ago

@maxmeno other than nicemenus, do you have any other modules installed that might affect either the menu entries (menu position module, maybe?) or the page title (metatag, or page_title module?)

Since none of us can reproduce the problem with core alone, and we don't think it's any of your template files, I'd expect a contrib module to be to blame. You can scan your whole "modules" directory for any instances of backdrop_set_title to see what might be setting a page title.