Adding DiscoTOC to Published Pages

This is great, thank you!

This makes me think, @joffreyjaffeux, that Discourse plugins are applied to published pages (e.g., footnotes) but theme components are not (e.g., table of contents). It might be tricky to implement since some components are not necessarily useful in the context of pages, but ToCs are definitely useful. Any chance we can have it?

9 Likes

It seems that theme components are only partially applied?
CSS is, but scripts in /head are not.
Or am I overlooking something?

5 Likes

at the moment page publishing is not designed to support theme components or anything using plugin api and especially decorateCooked.

Not saying this is impossible, but we didn’t work on it and at this point I dont know if we will.

9 Likes

I can understand that, after all there are no Ember components on those pages.

My question is just about some simple jQuery code (document.ready()) and things like GA, GTM. The simple and plain Javascript stuff, so to say. It would be sufficient if the </head> and <footer> sections of the theme component would be inserted as-is.

4 Likes

Maybe I didn’t try it, but wouldn’t that cause error with other themes trying to load code which is not available?

3 Likes

This is a wonderful feature! Are there any plans to support DiscoTOC in published pages?

10 Likes

Thanks for the quick confirmation.

FWIW, my need is to create several pages worth of related content. Ideally, I’d want separate pages, linked by some kind of navigation. AFAICT, this doesn’t seem possible with the current implementation. I requested the TOC as a workaround – having all the content on one page, navigable by the TOC.

The TOC would be great to have eventually, but in my case what I was really looking for is separate, but inter-connected pages. I’ll find another solution for the moment. But is something like this in the cards at all for the future?

6 Likes

Is there a plan, that the TOC is also visible for published pages? Page publishing was a feature introduced in discourse 2.5? This would be a huge benefit of this theme component!

8 Likes

Using the table-of-contents theme component on published pages would be awesome… That’s been mentioned a few times in this topic.

Any thoughts on if that could happen?

4 Likes

This is unlikely, as published pages don’t have access ton many JS features and there are currently no plan to extend this.

2 Likes