Skip to content

Commit d8380b7

Browse files
author
Pierre Buyle
committed
Add support for rss.xml and sitemap.xml files with language prefixes.
1 parent 8a2a99a commit d8380b7

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The following variables are available to configure the role:
7272
to ```["unix:/var/run/php-fpm.sock", "php-fpm-zwei.sock"]```.
7373
- **nginx_drupal_upstream_backup_servers**: The list of PHP upstream backup
7474
servers, defaults to ```["unix:/var/run/php-fpm-bkp.sock"]```.
75+
- **nginx_drupal_language_path_prefixes**: (optional) The list of enabled
76+
language path prefixes used on the site.
7577
- **nginx_drupal_sites**: The list of available sites.
7678
Each site uses the following structure:
7779
- **file_name**: The name of the site configuration file.

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ nginx_drupal_upstream_servers: ["unix:/var/run/php-fpm.sock", "php-fpm-zwei.sock
2828
nginx_drupal_upstream_backup_servers: ["unix:/var/run/php-fpm-bkp.sock"]
2929
nginx_drupal_sites: none
3030
nginx_drupal_http_pre_includes: []
31-
nginx_drupal_http_post_includes: []
31+
nginx_drupal_http_post_includes: []
32+
nginx_drupal_language_path_prefixes: []

templates/apps/drupal/drupal.j2

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ location / {
124124
}
125125
}
126126

127+
{% if nginx_drupal_language_path_prefixes %}
128+
## RSS feed support.
129+
location ~* ^(?:\/(?:{{ nginx_drupal_language_path_prefixes|join('|') }}))?\/rss\.xml$ {
130+
try_files $uri @drupal-no-args;
131+
}
132+
133+
## XML Sitemap support.
134+
location ~* ^(?:\/(?:{{ nginx_drupal_language_path_prefixes|join('|') }}))?\/sitemap\.xml$ {
135+
try_files $uri @drupal-no-args;
136+
}
137+
{% endif %}
138+
127139
## All static files will be served directly.
128140
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|svg)$ {
129141

@@ -384,5 +396,4 @@ location @empty {
384396
## Any other attempt to access PHP files returns a 404.
385397
location ~* ^.+\.php$ {
386398
return 404;
387-
}
388-
399+
}

0 commit comments

Comments
 (0)