# Notifications

Starting with Umbraco v9, the notification pattern is used for events throughout the application. SeoToolkit also comes with some notifications that you are able to hook into to change the data flowing through the package.

### GenerateSitemapNodeNotification

This notification is used for each node in the sitemap. You can hook into it to set your own defaults or to remove pages that shouldn't be shown.

```
public class ExampleSitemapNodeNotification : INotificationHandler<GenerateSitemapNodeNotification>
    {
        public void Handle(GenerateSitemapNodeNotification notification)
        {
            notification.Node.Priority ??= 0.5;
        }
    }
```

### GenerateSitemapNotification

This notification is used when all data for the sitemap has been gathered but before the actual rendering of it. This allows you to add new nodes to the page for dynamic pages.

```
public class ExampleSitemapNotification : INotificationHandler<GenerateSitemapNotification>
    {
        public void Handle(GenerateSitemapNotification notification)
        {
            notification.Nodes.Add(new SitemapNodeItem("https://google.nl"));
        }
    }
```

### BeforeMetaTagsNotification

This notification is used before the meta fields are generated by the fallback values. If you fill a value here, it'll not use the fallback value of the system.

```
public class ExampleBeforeMetaTagsNotification : INotificationHandler<BeforeMetaTagsNotification>
    {
        public void Handle(BeforeMetaTagsNotification notification)
        {
            if (notification.ContentTypeAlias.Equals("home"))
            {
                notification.MetaTags.Title = "Hello world!";
                return;
            }
        }
    }
```

### AfterMetaTagsNotification

This notification is used after the meta fields are generated by the fallback values. Here you can extend current values or overwrite them by your own values.

```
public class ExampleAfterMetaTagsNotification : INotificationHandler<AfterMetaTagsNotification>
    {
        public void Handle(AfterMetaTagsNotification notification)
        {
            notification.MetaTags.Title += "Bye!";
        }
    }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://seotoolkit.gitbook.io/useotoolkit/extensions/notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
