List of additional page paths

We have quite a few short URLs on our website. Short of going page by page and checking for additional page paths in the location settings, is there a way to get a list of short URLs in use?

@drdragonman5000 You could create a custom page list template and output the additional paths using the getAdditionalPagePaths() method of the page object. Something I’ve pondered, just haven’t gotten around to it yet! Send me a private message if you need any assistance.

https://documentation.concretecms.org/api/9.1.1/Concrete/Core/Page/Page.html#method_getAdditionalPagePaths

Thanks @enlil, I’ll mess around with that a bit and see what I can come up with.

@drdragonman5000 I went ahead and looked into this for my own purposes. Here’s an example of doing this, for yourself or anyone else reading this in the future…

Inside the foreach page loop in your template, after you have the page name displayed you need something to the effect of:

<?php $cPaths = $page->getAdditionalPagePaths(); ?>

<p><small><?php echo t('Canonical'); ?></small><br>
	<a href="<?php echo $page->getCollectionLink(); ?>" target="_blank"><?php echo $page->getCollectionLink(); ?></a>
</p>

<?php if (!empty($cPaths)) { ?>
	<p><small><?php echo t('Additional URLs'); ?></small><br>
		<?php foreach ($cPaths as $path) {
			echo '<a href="' . BASE_URL . $path->getPagePath() . '" target="_blank">' . BASE_URL . $path->getPagePath() . '</a><br>';
		} ?>
	</p>
<?php } ?>
1 Like