def breadcrumbs(url):
home = ['<li>you are here : <a href="/" title="Breadcrumb link to the homepage.">home</a> »</li>',]
links = url.strip('/').split('/')
bread = []
for link in links:
if not link == '':
bread.append(link)
this_url = "/".join(bread)
if not link == links[len(links)-1]:
this_link = '<li><a href="/%s/" title="Breadcrumb link to %s.">%s</a> »</li>' % (this_url, link, link)
else:
this_link = '<li>%s</li>' % link
home.append(this_link)
bcrumb = "".join(home)
return mark_safe(bcrumb)
Comments