diff --git a/spacy/displacy/render.py b/spacy/displacy/render.py
index bd7178724..406824eb4 100644
--- a/spacy/displacy/render.py
+++ b/spacy/displacy/render.py
@@ -316,6 +316,10 @@ class EntityRenderer:
end = span["end"]
kb_id = span.get("kb_id", "")
kb_url = span.get("kb_url", "")
+ if kb_id:
+ kb_link = """{}""".format(kb_url, kb_id)
+ else:
+ kb_link = ""
additional_params = span.get("params", {})
entity = escape_html(text[start:end])
fragments = text[offset:start].split("\n")
@@ -325,7 +329,7 @@ class EntityRenderer:
markup += ""
if self.ents is None or label.upper() in self.ents:
color = self.colors.get(label.upper(), self.default_color)
- ent_settings = {"label": label, "text": entity, "bg": color, "kb_id": kb_id, "kb_url": kb_url}
+ ent_settings = {"label": label, "text": entity, "bg": color, "kb_link": kb_link}
ent_settings.update(additional_params)
markup += self.ent_template.format(**ent_settings)
else:
diff --git a/spacy/displacy/templates.py b/spacy/displacy/templates.py
index 051f72cb2..53fcc1873 100644
--- a/spacy/displacy/templates.py
+++ b/spacy/displacy/templates.py
@@ -52,7 +52,7 @@ TPL_ENT = """
{text}
{label}
- {kb_id}
+ {kb_link}
"""