---
title: "Discussion on \"Drupal 9 : How to exclude node from sitemap.xml\" | Hashnode"
description: "Discussion on \"Drupal 9 : How to exclude node from sitemap.xml\". Sometimes we need to write some code to exclude nodes from the sitemap.xml based on custom conditions,\nThe XML sitemap module provides a hook to do this\nfunction mymodule_xmlsitemap_link_alter(array &$link, array $context) {\n  if (own_condition) {\n  ..."
url: "https://hashnode.com/posts/drupal-9-how-to-exclude-node-from-xmlsitemap/644c06c9760d6386ca01dca8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Drupal 9 : How to exclude node from sitemap.xml](https://sreenidrupaldev.hashnode.dev/drupal-9-how-to-exclude-node-from-xmlsitemap?utm_source=hashnode&utm_medium=feed)

Sometimes we need to write some code to exclude nodes from the sitemap.xml based on custom conditions, The XML sitemap module provides a hook to do this function mymodule\_xmlsitemap\_link\_alter(array &$link, array $context) { if (own\_condition) { ...

Apr 28, 2023 · 1 min read · sreenidrupaldev.hashnode.dev  
Read the article

-   [#drupal-xmlsitemap](https://hashnode.com/tag/drupal-xmlsitemap)

## Written by

[sreenu paruchuri](https://hashnode.com/@sreeniDrupaldev)

@sreeniDrupaldev

  
[View profile](https://hashnode.com/@sreeniDrupaldev)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
