Deck and subdeck names at the top of the card.

Hi. I’m trying to create a type of Anki note that displays the name of the deck at the top of the card, followed by the name of the subdeck below.

For example:


and then the card information would come below.

I researched and found that I should use {{Deck}} and {{Subdeck}}, but it didn’t work as I expected. The result at the top of the card was:


I would like to know if it’s possible to remove the “::Subjects” from the deck name, and only display the name of the main deck. Is that possible?

As far as I know, there is no built-in way to achieve that.

But maybe you could use some regex. For example:

<div id="deck_input" hidden>{{Deck}}</div>
<div id="deck_output"></div>

   var original_name = document.getElementById("deck_input").innerHTML;
   var shortened_name = original_name.replace(/::(.*?)$/, "");
   document.getElementById("deck_output").innerHTML = shortened_name; 

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.