def split_slug(slug):
 slug_split = slug.split('/')
 length = len(slug_split)
 root = None
 seo_root = ''
 bad_seo_roots = ['Web']
 if (length > 1):
  root = slug_split[0]
  if (root in bad_seo_roots):
   if (length > 2):
    seo_root = ((root + '/') + slug_split[1])
  else:
   seo_root = root
 specific = slug_split.pop()
 parent = '/'.join(slug_split)
 return {'specific': specific, 'parent': parent, 'full': slug, 'parent_split': slug_split, 'length': length, 'root': root, 'seo_root': seo_root}

def split_slug ( slug ) : slug_split = slug . split ( '/' ) length = len ( slug_split ) root = None seo_root = '' bad_seo_roots = [ 'Web' ] if ( length > 1 ) : root = slug_split [ 0 ] if ( root in bad_seo_roots ) : if ( length > 2 ) : seo_root = ( ( root + '/' ) + slug_split [ 1 ] ) else : seo_root = root specific = slug_split . pop ( ) parent = '/' . join ( slug_split ) return { 'specific' : specific , 'parent' : parent , 'full' : slug , 'parent_split' : slug_split , 'length' : length , 'root' : root , 'seo_root' : seo_root }
utility function to do basic slug splitting .