Snippets in topic templates

This forum is for all Flare issues not related to any of the other categories.
Post Reply
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Snippets in topic templates

Post by Dafra08 »

Does anyone use snippets in topic templates?

I am quite sure I read somewhere that that should be perfectly possible in some Madcap blog, or in the online help, but right now I can't find where. Anyway, the problem is it does not work for me. I get ”missing or bad snippet” when creating a new topic based on a topic template that contains snippets. What am I missing?
  • When opening the template file everything looks fine.
    When opening the snippet file everythings looks fine.
    The snippets work when inserting them directly into topics.
    No difference if the snippets are nested or not.
    It works perfectly fine to base new topics off of the topic templates, except that the snippets show up as ”missing or bad snippet”, so the snippets have to be inserted manually into the topics.
I do store the topic templates within the Flare project. Could that be the problem? (Although I am quite sure I read somewhere that that should be possible as well, and it is, since the template files actually do work ...)
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Snippets in topic templates

Post by Dafra08 »

Just got a reply from support. Turns out Flare does not support snippets in topic templates, but there is a feature request about it.

Anyway, my big worry right now is my strong memory of reading that it was possible somewhere. Am I getting delusional? Losing my mind? Hallucinating ...? All of the above?
Chicago_HPT
Sr. Propeller Head
Posts: 133
Joined: Sun Feb 03, 2013 6:01 pm

Re: Snippets in topic templates

Post by Chicago_HPT »

I use snippets in some of my templates. I suspect the problem might be that the path to the snippet is relative, meaning that it is x folders up and over from the template file. When you create a new topic, that topic is now in a different folder and so following the relative path back to the snippet won't find the snippet.

for example:
Content\Templates\Topic Templates\template.htm
Content\Resources\Snippets folder
Path to snippet = ../../Resources/Snippets Folder

Content\Topic folder\topic.htm
Path to snippet = ../Resources/Snippets Folder

One possible fix could be to open the template in the text editor and manually change the path to the snippet to an absolute path. I.e., change "../../Resources" to "Contents/Resources" I don't know if that will work but it might be worth a try. Note that, if that works, it could break if you later move the snippet to a different location.

I hope that helps,
-jeff
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Snippets in topic templates

Post by Dafra08 »

Brilliant! Thanks a million! I only tried one of my templates so far, but it seems to work well. When checking the actual topic file based on the template, the snippet path is ”Resources/Snippets/<folder>, so no need to put ”/Content” in there.

No worries about breaking it in case of moving the snippet. The alternative is non-functional anyway :)
Chicago_HPT
Sr. Propeller Head
Posts: 133
Joined: Sun Feb 03, 2013 6:01 pm

Re: Snippets in topic templates

Post by Chicago_HPT »

Okay, so "Content" is the "root" folder and so all paths are presumed to begin there.

I'm glad you've got it working.

Happy writing!
-jeff
Post Reply