omit unpublished pages from backlinks
This commit is contained in:
parent
fdcdb6a766
commit
bc759bbaf9
|
@ -89,8 +89,8 @@ def template_vars(node: SourceNode, ctxt: Context) -> dict[str, Any]:
|
||||||
tvars["dragonglass_version"] = __version__
|
tvars["dragonglass_version"] = __version__
|
||||||
tvars["python_version"] = f"{sys.version_info[0]}.{sys.version_info[1]}.{sys.version_info[2]}"
|
tvars["python_version"] = f"{sys.version_info[0]}.{sys.version_info[1]}.{sys.version_info[2]}"
|
||||||
|
|
||||||
# Compute backlinks for this node.
|
# Compute backlinks for this node. Don't include nodes that aren't published.
|
||||||
backlinks = sorted(node.backlinks, key=lambda n: n.page_title)
|
backlinks = sorted([n for n in node.backlinks if n.publish], key=lambda n: n.page_title)
|
||||||
tvars['backlinks'] = [{'title': n.page_title,
|
tvars['backlinks'] = [{'title': n.page_title,
|
||||||
'link': n.link_target(ctxt.url_prefix, node if ctxt.relative_links else None)}
|
'link': n.link_target(ctxt.url_prefix, node if ctxt.relative_links else None)}
|
||||||
for n in backlinks]
|
for n in backlinks]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user