1

I want to add a Wikipedia-style index to this post. Is it possible? How do I do it?

2

The standard way to do that, which Wikipedia employs, is with HTML code called an ID attribute.

The way it generally works is that they wrap text in an HTML element called a span. It looks like this:

<span>Some text here</span>.

They make it so you can link to it by giving the span an ID attribute, like this:

<span id="section-to-link-to">Article text goes here</span>

Then they link to it with a link like wikipedia.org/Article_title#section-to-link-to. The # sign lets the browser know to look for a span* with the ID "section-to-link-to" on that page.

I gave this a quick try on the article that you're looking at, but Bicycles SE just ignored the HTML. (There are good reasons for this, but they're too technical to go into here.) There may be a way to override that, but I'm guessing the mods would need to get involved. There may also be a completely different way to do that on SE sites that I'm not aware of.

*You can actually give almost any, if not all, HTML elements an ID and this will work. Wikipedia just happens to use span.

  • It'd be better to add id="..." to an h1 or h2, rather than a span, but SE's code will strip those anyways. Mods can't override that. SE developers would need to do something about it. Changing this question from support to feature-request should get the right SE people's attention. Since it could be abused (even accidentally) to mess up the page display and isn't a common request, it seems unlikely to happen, though. Maybe convince SE to automatically add ids to in-post headers, instead, like 869-1 for first header in post 869? – freiheit Dec 30 '13 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .