New Plugin: Permalinks 1.00 Released (Feb 19)

13 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 12, 2013   (RSS)

By Dave - March 12, 2013

Hi Tim & Djulia,

Thanks for your suggestions and feedback.  We've got a version 1.01 we'll be releasing after CMSB 2.52 with the following updates:

NEW FEATURES
- Preview URL Support: Added support for web servers that use /~username/ preview urls
- Custom Querystrings: Added support for custom query strings in manual permalinks: ?like=this&or=that
- SEO Optimization: Latin accents are automatically removed from permalinks (same as "remove accents" viewer links plugin)
- Documentation: Added instructions to readme.txt on avoiding broken links with site-root relative links (starting with /)

CODE CHANGES & BUG FIXES
- Improved error reporting for when server paths or urls aren't set correctly
- Added "old" field to Permalinks DB to make it easier to identify which permalinks were old
- Misc Code and other minor improvements

Also: 

  • Tim suggested we have a way to automatically create permalinks for an existing section, I've made a note to add that to a future release
  • And for a sitemap generator, I've added an 'old' field to exclude old permalinks, so just create a RSS feed with the code generator and then change the tablename to _permalinks and the fields to match and adjust the XML as needed.  Let me know if you need a hand with this.  If it's popular we can add a custom code generator for it to a future release.

Hope that helps, let me know any questions or feedback! Thanks.

Dave Edis - Senior Developer
interactivetools.com

By Toledoh - March 12, 2013

Looking great!

This seems to produce a valid sitemap, but someone who knows more about this stuff - please comment!

http://fibreking.com/sampleSiteMap.xml.php

<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/XXX/XXX/XXX/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records from '_permalinks'
  list($_permalinksRecords, $_permalinksMetaData) = getRecords(array(
    'tableName'   => '_permalinks',
    'orderBy'     => '',   // use default database order
    'loadUploads' => false,
    'allowSearch' => false,
  ));

?>
<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<'.'?xml version="1.0" encoding="UTF-8"?>'; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

    <?php foreach ($_permalinksRecords as $record): ?>
   <url>

    <loc>http://<?php echo $_SERVER['HTTP_HOST']; ?>/<?php echo $record['_link'] ?></loc>
    
    <lastmod><?php echo date('Y-m-d', strtotime($record['updatedDate'])) ?></lastmod>
    
    <?php if ($record['old']): ?><changefreq>never</changefreq>  
    <?php else: ?><changefreq>weekly</changefreq>  
    <?php endif ?> 
    
    <priority>0.5</priority>

   </url>
    <?php endforeach ?>

</urlset> 

Cheers,

Tim (toledoh.com.au)