thexerteproject / xerteonlinetoolkits

Xerte Online Toolkits
www.xerte.org.uk
Apache License 2.0
62 stars 61 forks source link

Custom section IDs in Bootstrap - have these ever worked? #1248

Closed FayCross closed 3 months ago

FayCross commented 10 months ago

While fixing another issue (https://github.com/thexerteproject/xerteonlinetoolkits/issues/1242) I've noticed that the sectionID in Bootstrap doesn't work as I'd expect. If you add an ID to a page then you add #pageID to end of URL and it will take you straight to that page. I can't work out how you can use the custom section IDs in the URL to jump directly to a particular section (neither #sectionID or #pageIDsectionID work). The only way I can jump to a particular section via the URL is using the section's number (e.g. #pageIDsection2).

I think custom section IDs were added by one of your students @torinfo - am I missing an obvious way of doing this. I have fixed the code so it doesn't stop section links within the page from working but don't think section IDs are being used in a useful way at moment.

torinfo commented 10 months ago

@FayCross #sectionID should have worked. I have not yet updated my dev enviroment, so will do so later today. It works for mee at the moment and I will let you know if it still works after the update.

Note that the sectionID has to be unique in the project.

FayCross commented 3 months ago

There are lots of ways of linking to specific pages and sections in Bootstrap projects - ideally there would just be one way but it looks like lots of different versions have been used over the years. The following will all work when appended to end of URL after a #:

  1. page2, 2, info : will all link to page 2 that has been given a custom ID of 'info'
  2. page2section2, page2|section2, page2|2, 2section2, 2|section2, 2|2, infosection2, info|section2, info|2 : will all link to section 2 on page 2 (with page having custom ID of 'info')
  3. faq : will link to a section that has been given a custom id of 'faq' (page2|faq etc. will also work but page info will be ignored if faq section is on a different page)
  4. section2 : will default to 2nd section on 1st page as page is not specified
  5. content2, |content2, |2 can be appended to all formats in 2 above to link directly to a content block within a section. For this to work you must have the title for the content block shown.
  6. tabtwo : will link to a navigator pane that has been given a custom ID of 'tabtwo'. Custom IDs must be added to panes for this to work - you can not link by index alone.