Skip to content

Add support for sub sections (anchor links) #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arikfr
Copy link

@arikfr arikfr commented Nov 8, 2016

No description provided.

@@ -53,7 +53,7 @@ <h3 class="panel-title">{{ "FAQ_RELATED_ARTICLES"|t }}</h3>
{% for related in page.related %}
{% set relatedArticle = getArticleByPath(related) %}
{% if relatedArticle %}
<a href="{{ relatedArticle.path|resolveFile }}" class="list-group-item">{{ relatedArticle.title }}</a>
<a href="{{ relatedArticle.path|resolveFile }}{{ relatedArticle.anchor }}" class="list-group-item">{{ relatedArticle.title }}</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will find the first article with matching path, and use this article's anchor. But that's not really what we would like here. If we have several articles pointing to the same file, we should expect the related property to have the anchor included, so that related refer without ambiguity to a particular article.

So we should do something like getArticleByPathWithAnchor(related)... but this is not in the API. So I would not implement it until GitBook v4 is finished.

Do you have a use-case for this?

@@ -22,7 +22,7 @@ <h3 class="panel-title">
<div class="list-group">
{% for article in part.articles %}
{% if article.path != readme.file.path %}
<a href="{{ article.path|resolveFile }}" class="list-group-item">
<a href="{{ article.path|resolveFile }}{{ article.anchor }}" class="list-group-item">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. I'll happily merge this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants