Skip to content

Instantly share code, notes, and snippets.

@cristiroma
Created November 3, 2017 18:19
Show Gist options
  • Save cristiroma/675ea0a52cae2a2476d8e9e7515e37bc to your computer and use it in GitHub Desktop.
Save cristiroma/675ea0a52cae2a2476d8e9e7515e37bc to your computer and use it in GitHub Desktop.
An SQL query to URL to all published web pages (nodes) in a Drupal installation from url_alias
select concat('http://your.website.url/', c.langcode, c.alias) url from node a
inner join node_field_data b on a.nid = b.nid
inner join url_alias c on CONCAT('/node/', a.nid) = c.source AND c.langcode = 'en'
where b.status = 1 group by a.nid
UNION
select concat('http://your.website.url/', c.langcode, c.alias) url from node a
inner join node_field_data b on a.nid = b.nid
inner join url_alias c on CONCAT('/node/', a.nid) = c.source AND c.langcode = 'fr'
where b.status = 1 group by a.nid
UNION
select concat('http://your.website.url/', c.langcode, c.alias) url from node a
inner join node_field_data b on a.nid = b.nid
inner join url_alias c on CONCAT('/node/', a.nid) = c.source AND c.langcode = 'es'
where b.status = 1 group by a.nid
ORDER BY url;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment