Advanced uses of Tags in Lothrea | World Anvil

Advanced uses of Tags

This article is depicting a potential future of this world. Some events in here might not have happened yet and will be changed by the actions of the players involved in this world. Until these campaigns have concluded, this article will exist in a superposition between existance and non-existance.   Some version of this article will survive, but who knows what it will be when all of this is over
Tags are a very powerful tool to organise your world, but there are a couple use cases you might not have thought off. If you've browsed my world previously, you might not even notice me using tags, but behind the scenes, many things are automated using tags. They provide a way for me to generate automated indices (e.g. Index and Cities & Settlements) or more cross linking fields on my settlements and deities.


I won't go in depth on the basics of the tagging system, as there is already an amazing Codex article about that. But in short, they are a way to:
  1. categoriese your articles in addition to categories
  2. mark your articles to be included by various features of WA (diplomancy webs, tagged lists...)

Tag based Content

This is a way to show and hide messages, depending on the tags you put on your article. This will cut down on copy-pasting the message from one article to another. Just add the tag, and the message will appear automatically.
  • Automatically show a "This is a stub" or "This article is still under construction" message on your articles, just by tagging them "stub" or "wip"
  • Automatically add trigger warnings, just by adding a tag, which you might be already using for categorisation anyways.
WorldAnvil features:
  • You can add Global Content to every article in your world.
  • You can show and hide specific content with css
  • Every tag is added as a css class to your article

Step 1: Add your global content
You can find various global fields in your world settings under Settings > Display > Global Content, which show up on every article in your world. For this we will be using the GLOBAL ARTICLE ANNOUNCEMENTS BLOCK (SIDEBAR TOP) field, so scroll down a bit until you find it.   In here define a container for every tag you want to use. All these containers need one general css class tag-info and one specific to the tag you want to use tag-info-<customtag>.  
[container:tag-info tag-info-stub]
<Your Content>

Step 2: Add the CSS
.user-css .world-global-annnouncement .tag-info{
display: none !important;
.user-css.tag-stub .world-global-annnouncement .tag-info-stub{
display: block !important;
The Css uses two pieces. First we will have to hide all tag based content containers, so they don't show up when we don't need them.
Then we will add a seperate block for each tag based content container we want to use. Replace the bold parts with your own tag if you want to use different ones.

Index / Glossary

This will give you a single article in your world, which lists all other articles in alphabetical order. This is a very nice way for people to find things in your world, or just browse it for random content.
Example: Index

Simple Glossary

The idea behind this is actually pretty simple. Tagged lists can pull all articles with a specific tag, and will list them in alphabetical order. To format our Glossary a bit better, we will use one tag per starting letter. So in the end we will tag every article starting with an 'A' with the tag 'idx-a', every article starting with a 'B' with 'idx-b' and so on.  
Step 1: Copy the Glossary BBCode into a new generic article in your world
Hint: The world anvil search includes tags. Usually this is a very useful feature, but for our use case this is counterproductive as we will have to tag every article in the world. To mitigate this, I recommend using tags you will not search after. This is the reason why I named all tags below 'idx-b' instead of 'index-b'
Step 2: Tag all your articles
Hint: If you want to have a more complex Glossary / Index system, skip this step for now and read the section below. Now you will have to go through all your articles and tag them accordingly. After you've done that, your Glossary page should now show every article.  

Complex Glossary

When your world grows bigger and bigger, a simple Glossary might not be enough to help your readers easily find your articles. Having articles sorted by types in addition to one big Glossary might be very useful for you.   To understand how this works, you need to understand one fundamental thing about tagged lists. Tagged list do not just grab each article with a specific tag, but they do a "contains" check. For example, if you tag an article with #article #character, a list using either #article or #character will show this article. But it goes even further. If you tag an article with #index-character, both #index and #index-character will match. And this is what we'll be using to generate more complex glossaries.  
Step 1: Decide on which additional Glossaries you want to use
First you'll have to decide, which additional Glossaries you want to have. Maybe you want to have an extra glossary for your characters, or for every tavern in your world? Maybe a list of all settlements?   Either way, make a list and note down an identifier you want to use for each glossary. In this example, I will create a Glossary for all characters in my world, using the short-form char as an identifier. As this glossary will include fewer links than the last one, I will use a slightly different layout.  
Step 2: Create the glossary
Step 3: Repeat for all glossaries you want to have
Now just repeat the process above for all the other glossaries you want to use. The amazing thing? Using tags in this way means by tagging an article with a single tag, it will show up in the correct place on your main glossary, and on the smaller glossaries as well.   But you don't have to stop there! This is nearly endlessly nestable. You want to have a glossary for all buildings, and one for every tavern? That’s really simple! Just tag all your taverns with something like #idx-a-building-tavern and you can create a glossary just checking for the building part, and one that checks for the tavern!  
Step 4: Tag all your articles!
Now go ahead and tag all your articles, and watch them magically appear on your glossary pages!  
Bonus Step 5: Create automatic links back to your glossaries!
Combining Tag Based Content, and our new Glossary system, we can easily add automatic backlinks to every glossary to every article. So when you tag an article for a glossary, the link will just appear at the end of that article!  
Step 5.1: Add the global content
Add your backlinks to your global content. You can once again find them under Settings > Display > Global Content. This time, we will use the GLOBAL COPYRIGHT FOOTER block. Repeat the second line for each index you created above.
[container:index-read-more index-read-more-title]Categories[/container]
[container:index-read-more index-read-more-char]@[Characters](article:25fed803-dd18-4051-a6af-407ffdaaaaf4)[/container]
Step 5.2: Add the css .index-read-more{
display: none !important; 
}[class*=tag-idx][class*=-char] .index-read-more-title,[class*=tag-idx][class*=-char] .index-read-more-char
display: inline-block !important;
  The first block will remove every link by default. The second block then shows the correct link for each article. If you've created multiple glossaries, duplicate this block, replacing char with the key you've used.


Please Login in order to comment!
Sage nnie
Annie Stein
22 Nov, 2022 14:15

Thank you so much for this guide! I didn't realize how powerful tags could be until I saw how you used them.

Creator of Solaris -— Come Explore! | Summercamp in Solaris
24 Nov, 2022 21:20

Tags are really incredibly powerful! Glad I could help!

Summercamp is here, and once again I'm joining in! Summercamp 2023. Want to find more of my things: SatriumHub
24 Nov, 2022 22:25

Such a great article and very well presented! And yes tags are amazingly powerful. One of my favorite WA features.

26 Nov, 2022 16:46

Thank you! Yes, tags are incredibly powerful, that's why I wanted to show some ways of using them and maybe spark some ideas :)

Summercamp is here, and once again I'm joining in! Summercamp 2023. Want to find more of my things: SatriumHub
26 Nov, 2022 17:25

Thank you, this article had really brought home a good reason for and use of tags. Ugg, I have nearly 1700 articles to go thorugh. I do like to stay busy, lol.

Happiness is "the exercise of vital powers, along lines of excellence, in a life affording them scope,"
28 Nov, 2022 12:29

Tags are incredibly helpful and powerful, but it's also a lot of work introducing them when you already have a lot of articles. On the other hand, once you've introduced a system that works for you, it's very little work to keep it up to date (as long as you remember tagging new things).   Hope this article was helpful to you, and if you have any more questions about anything in this article or tags in general, feel free to just reach out!

Summercamp is here, and once again I'm joining in! Summercamp 2023. Want to find more of my things: SatriumHub
Powered by World Anvil