Removing a portal page from the navigation

In this recipe, we will export the sitemap configuration from the portal and update the navigation.xml file to hide the page. Once updated, the ZIP will be imported back into the portal to overwrite the existing configuration for the sitemap.

Getting ready

The following are required for this recipe:

  • GateIn-3.2.0.Final
  • Deploying the CLI to GateIn recipe from this chapter to have been completed

How to do it...

To remove the sitemap page from the navigation:

  1. Start the server.
  2. Open an SSH connection to the CLI by entering the following command:
    > ssh -p 2000 root@localhost
    
  3. Enter the password for root when requested. With the standard GateIn install, the password is gtn.
  4. At the shell prompt, enter the following:
    > mgmt connect
    
  5. Enter the password for root user again.
  6. At the shell prompt, enter the following:
    > export --file /tmp/mop.zip --filter site-name:classic;page-name:sitemap;nav-uri:sitemap /mop
    
  7. Open the ZIP file that was created above.
  8. Edit navigation.xml in the portal/classic folder of the ZIP file by changing DISPLAY to HIDDEN in the <visibility> tag of the sitemap navigation element.
  9. Go to http://localhost:8080/portal to see the SiteMap menu option next to Home on the homepage, as shown in the following screenshot:
    How to do it...
  10. At the shell prompt, enter the following:
    > import --file /tmp/mop.zip /mop
    
  11. Refresh the browser to reload the homepage of the portal and notice that the SiteMap menu option is no longer present next to Home, as seen in the following screenshot:
    How to do it...

How it works...

Step 6 exports the configuration from the classic portal, applying filters to only retrieve the sitemap page and navigation. It was not strictly necessary to filter for sitemap, but it makes it simpler to find the entry you want to edit and it also prevents inadvertently editing other navigation nodes or pages and potentially corrupting the portal.

Step 8 edits the navigation.xml to mark the SiteMap as HIDDEN.

Step 10 imports the mop.zip content back into the portal. As an import-mode was not specified, it uses the default of merge, which updates existing data that already exists and creates it when it doesn't. If the import-mode was set to conserve or insert in our recipe, then no change would have been applied to the portal.

There's more...

Now we'll show some other ways the navigation of the portal can be modified.

Changing the navigation path

Instead of removing the SiteMap from the navigation, we could move it to beneath the Home menu.

To move the SiteMap menu item:

  1. Connect to the CLI and at the shell prompt enter:
    > export --file /tmp/mop.zip --filter site-name:classic /mop
    
  2. Open mop.zip and edit navigation.xml.
  3. Move the <node> containing the sitemap to before </node> of the homepage node. It should now look as follows:
      <page-nodes>
       <node>
        <name>home</name>
        <label xml:lang="en">Home</label>
        <visibility>DISPLAYED</visibility>
        <page-reference>portal::classic::homepage</page-reference>
        <node>
         <name>sitemap</name>
         <label xml:lang="en">SiteMap</label>
         <visibility>DISPLAYED</visibility>
         <page-reference>portal::classic::sitemap</page-reference>
        </node>
       </node>

    Note

    In the above navigation.xml snippet, the tags for non-English languages and additional navigation nodes have been removed for brevity. Removing them from the actual file would result in them being removed from the portal.

  4. Save the changes and update mop.zip.
  5. At the shell prompt enter:
    > import --file /tmp/mop.zip --importMode overwrite /mop
    

    Note

    Note the use of the overwrite importMode. This ensures that the existing sitemap node at the same level as home is removed. Without the overwrite setting, the portal would have two sitemap menu options.

  6. Go to http://localhost:8080/portal, or refresh the home page if you are already there. It should now appear as the following screenshot:
    Changing the navigation path

Modifying the navigation node label

It is also possible to edit the labels of a navigation node, and therefore change the name that is visible to the user within the portal.

To modify the navigation node label:

  1. Connect to the CLI and at the shell prompt enter:
    > export --file /tmp/mop.zip --filter site-name:classic /mop
    
  2. Open mop.zip and edit navigation.xml.
  3. Find the sitemap <node> section and set the value within <label xml:lang="en"> to Page List.

    Note

    Note that it would also be necessary to modify the label value for all languages that are present within the <node> definition. In this case, for brevity, only the English language label was modified.

  4. Save the changes and update mop.zip.
  5. At the shell prompt enter:
    > import --file /tmp/mop.zip --importMode overwrite /mop
    
  6. Go to http://localhost:8080/portal. It should now appear as the following screenshot:
    Modifying the navigation node label

See also

  • The Exporting a portal page with the CLI recipe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.171.212