-
Notifications
You must be signed in to change notification settings - Fork 378
Managing links and urls
Links in Baker can be divided in three distinct category: internal, external and book.
### 1. Internal links
These are the links that target a single HTML file inside the book folder, for example:
<a href="new-page.html#anchor">Link to new page</a>
There are two different behaviors associated to internal links, based upon the type of file linked:
- the file is a book page: Baker will scroll the book to the page linked and load its content. If the page linked is the current page Baker will reload the page content.
- the file is not a book page: Baker will load the content of the file linked inside the current page, replacing its content with the new one.
If an #anchor
is specified the content of the page will scroll down to the first element with the attributes id
and name
that match the anchor.
These are the links that target a external HTML page, for example:
<a href="http://www.external-site.com?referrer=baker">Link to external site</a>
There are two different behaviors associated to external links, based upon the referrer attribute:
- the attribute referrer is specified and it's equal to baker: Baker will open the page linked in Safari Mobile.
- the referrer attribute is not specified / is not equal to baker: Baker will load the content of the page linked inside the current page, replacing its content with the new one.
These are links to new books, for example:
<a href="book://www.mysite.com/books/new-book.hpub/page.html#anchor">Link to new book</a>
These links are defined by the special book://
protocol; when a book link is clicked Baker will download and open the linked book, replacing the current one.
If page.html
is specified and it's a valid page of the new book Baker will automatically open the new book at that page.
If an #anchor
is specified the content of the page will scroll down to the first element with the attributes id
and name
that match the anchor.