gfranko / jquery.tocify.js

A jQuery Table of Contents plugin that can be themed with Twitter Bootstrap or jQueryUI.
http://gregfranko.com/jquery.tocify.js/
MIT License
927 stars 217 forks source link

Multiple sub menu items with the same string values results in undesirable URLs #62

Closed Joyce-Stack closed 10 years ago

Joyce-Stack commented 10 years ago

Hello,

You can observe this error in the wild by going to the following URL and observing - http://dev.mendeley.com/slate/

  1. Scroll to Documents and observe the sub header entry of 'Retrieve a document' and observe the URL 'http://dev.mendeley.com/slate/#retrieving-documents'
  2. Scroll to Catalog and observe the same sub header entry of 'Retrieve a document' and observe the URL 'http://dev.mendeley.com/slate/#retrieving-documents16'

It seems having the same text more than once on the same page will result in undesirable URLs.

It would be desirable to be able to provide a desired URL or at least include the main resource and sub resource together in the final URL.

gfranko commented 10 years ago

Have you tried creating a custom hashGenerator option function?

lord commented 10 years ago

This is a bug with Slate, not with Tocify! IIRC we're using a custom hashGenerator that uses the existing ID of headers, but the ID generation isn't perfect.

gfranko commented 10 years ago

Ahh gotcha, thanks!