Docs: Setting up two-column layout on docs homepage

Quick update. I’ve decided to scratch the idea of using the raw directive to add html to the docs homepage. I realized today that in order to accomplish what I want (add two-column layout with links to individual topics), I would have to use hyperlinks. That seems undesirable given that it would make it easier to break the URL links if the LLVM docs site were ever moved/updated.

I spent a few hours today trying to determine if there was a possible workaround. It doesn’t look like there is. So for now I’ll continue with my efforts using a single-column layout.


Can you not use css for this?

div.body {
column-count: 2;


You’ll need some other cleanups to make it pretty, but it works. There’s also flexbox and grid stuff you can do. Flexbox works on all modern browsers, and grid works on the major 4.

  • Michael Spencer

Thanks for the suggestion, I don’t know why it didn’t occur to me to just modify the existing CSS. I guess I’m still getting up to speed as to what I can do with Sphinx.

Setting the column count on div.body doesn’t quite work… but setting it on dl.docutils does. Of course, if I do that, I’m setting two columns on all sections. Which wasn’t my original intention (to set two columns for all sections), but I can definitely work with it as a compromise. The Reference section is a good example of what I’m trying to accomplish. The section would be titled ‘Reference’ and would have a brief introductory sentence. Below that would be two sub-sections w/links, displayed in a two-column format: one column for LLVM Reference and another for API Reference.

I haven’t used Flexbox before so I’ll be sure to check it out.