Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extra - when setting title for homepage #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,20 @@ public boolean f(Element e, int index) {
GQuery subMenuItem = liParents.last();

subMenuItem.show();
String mainNavigationHref = subMenuItem.children("a").attr("href");
GQuery section = subMenuItem.children("a");
String mainNavigationHref = section.attr("href");

$("#nav a.active").removeClass("active");
$("#nav a[href='" + mainNavigationHref + "']").addClass("active");
$("#submenu .active").not(liParents).removeClass("active");
liParents.add(selectedItem).not(selectedItem.parent()).addClass("active");

// Change the page title for easy bookmarking
$("title").text("[GWT] " + subMenuItem.children("a").text() + " - " + selectedItem.text());
if (section.isEmpty()) {
$("title").text("GWT Project Homepage");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably remove the word "Homepage".

Currently there are

  1. gwtproject.org
  2. gwtproject.org/overview.html

which do not have a submenu. So both would show "GWT Project Homepage" even though only 1. should.

In order to fix the overview.html page and being able to set a title for it, the code would also need to check GQuery selectedItem = $("#nav a[href='" + path + "']") because the current path isn't found in a #submenu (see line 128).

} else {
$("title").text("[GWT] " + section.text() + " - " + selectedItem.text());
}

boolean homePage = isHomePage(path);
boolean overviewPage = isOverviewPage(path);
Expand Down