Skip to content

17. SEO

Frank Hossfeld edited this page Nov 28, 2019 · 1 revision

SEO-Support

Nalu supports simply setting SEO meta tags and the page title.

Nalu will collect all SEO information during a routing and will update the SEO information at the end of a routing. To set a SEO-information call a setter-method.

setter-methods are available for the following meta information:

  • title: updates the title of the host page

Standard meta tags:

  • description: meta tag with name 'description'
  • keywords: meta tag with name 'keywords'
  • robots: meta tag with name 'robots'

Meta tags for Facebook integration:

  • og:title: the 'og:title' meta tag
  • og:image: the 'og:image' meta tag
  • og:type: the 'og:type' meta tag
  • og:url: the 'og:url' meta tag
  • og:sitename: the 'og:sitename' meta tag
  • og:description: the 'og:description' meta tag

Meta tags for Twitter integration:

  • twitter:card: the 'twitter:card' meta tag
  • twitter:title: the 'twitter:title' meta tag
  • twitter:description: the 'twitter:description' meta tag
  • twitter:image: the 'twitter:image' meta tag
  • twitter:site: the 'twitter:site' meta tag
  • twitter:creator: the 'twitter:creator' meta tag

To set these values use the following code:

     SeoDataProvider.get()
                     .setTitle("Example - Edit Persons Name: >>" + this.person.getName() + ", " + this.person.getFirstName());

      SeoDataProvider.get()
                     .setDescription("Here you will edit the person selected from the result list");
      SeoDataProvider.get()
                     .setKeywords("Person, edit, cool");
      SeoDataProvider.get()
                     .setRobots("index,follow");
      SeoDataProvider.get()
                     .setOgDescription("I am OG description ...");
      SeoDataProvider.get()
                     .setOgImage("http://www.gwtproject.org");
      SeoDataProvider.get()
                     .setOgSiteName("Max Mustermann");
      SeoDataProvider.get()
                     .setOgTitle("Title: Max Mustermann");
      SeoDataProvider.get()
                     .setOgType("website");
      SeoDataProvider.get()
                     .setOgUrl("http://www.gwtproject.org");
                     
      SeoDataProvider.get()
                     .setTwitterCard("Twitter Card: Max Mustermann");
      SeoDataProvider.get()
                     .setTwitterCreator("Twitter Creator");
      SeoDataProvider.get()
                     .setTwitterDescription("Twitter Description");
      SeoDataProvider.get()
                     .setTwitterImage("http://www.gwtproject.org");
      SeoDataProvider.get()
                     .setTwitterSite("http://www.gwtproject.org");
      SeoDataProvider.get()
                     .setTwitterTitle("Twitter Title");

In case a routing is handled by more than one controller and the second controllers also tries to update the SEO data, Nalu will use the data the first controller has set!

In case a controller wants to make sure that the value is used, call: SeoDataProvider.get().setTwitterTitle("Twitter Title", true);-method. In this case the value will be set even there is already a value.

After Nalu has updated the SEO tags, the data gets reset.

Nalu will only update the tags which gets change by the current routing. No tags will be removed!

Note: Meta tags will only be updated in case the routing was successful!