Book Image

Beginning Server-Side Application Development with Angular

By : Bram Borggreve
Book Image

Beginning Server-Side Application Development with Angular

By: Bram Borggreve

Overview of this book

Equip yourself with the skills required to create modern, progressive web applications that load quickly and efficiently. This fast-paced guide to server-side Angular leads you through an example application that uses Angular Universal to render application pages on the server, rather than the client. You'll learn how to serve your users views that load instantly, while reaping all the SEO benefits of improved page indexing. With differences of just 200 milliseconds in performance having a measurable impact on your users, it's more important than ever to get server-side right.
Table of Contents (10 chapters)

Adding Dynamic Metadata


Now that our pages can be rendered using server-side rendering, we can introduce new functionality to enhance the appearance of our app.

At the moment, our app will still only display the default title set in src/index.html and we won't have any other HTML meta tags added.

To enhance the SEO friendliness of our page, and to make sure there is valuable information in our social preview, we want to address this.

Luckily, Angular comes with the Meta and Title classes, which allow us to add dynamic titles and metadata to our pages.

When combined with server-side rendering, the metadata and page title will make sure that the pages that are indexed by the search engine have the proper meta tags set in the document header, and thus increase findability.

In this section, we will add a service that allows us to define this data, and we will update our container components to call in that service after the data is loaded from our resolvers.

Creating the UiService

  1. Open a terminal inside...