Skip to content
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

Preserve Section Title in Chunked Pages #30

Open
tajmone opened this issue Nov 9, 2021 · 3 comments
Open

Preserve Section Title in Chunked Pages #30

tajmone opened this issue Nov 9, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@tajmone
Copy link
Contributor

tajmone commented Nov 9, 2021

Currently every chunked page has the same <title>. It would be nice is each page (beside the Title Page) could instead show its Section title in <title>; i.e. by extracting it from the first <h2> tag encountered in each chunked page.

This would allow readers to always see the in the browser title of the sections they are currently viewing (useful in documents with very long chapters), as well as in other types of publications (exeBooks, etc.) where there's a title bar showing the <title> contents of the current page being navigated.

Additionally, a command line switch could allow to define a prefix to be added in <title>, before the extracted section title, so that users can insert the book title (or a brief version of it). E.g. using the option --title-suffix="Git Book:" would produce titles like "Git Book: Introduction", "Git Book: 1. Installing Git", etc., in the chunked pages.

This would also improve the visibility of a publication on search engines, since the <title> tag is parsed for keywords and has a high impact in terms of ranking.

@wshito
Copy link
Owner

wshito commented Nov 10, 2021

This should be done in your asciidoc source files. You can easily achieve it with setting attributes conditionally. Asciidoctor-chunker is a tool to split single html, not a tool to modify the document contents.

@wshito wshito closed this as completed Nov 10, 2021
@tajmone
Copy link
Contributor Author

tajmone commented Nov 11, 2021

This should be done in your asciidoc source files. You can easily achieve it with setting attributes conditionally. Asciidoctor-chunker is a tool to split single html, not a tool to modify the document contents.

I don't think this is possible to achieve from AsciiDoc sources: it's the chunker that decides what goes into the <title> tag of each split HTML document.

At the most, in the AsciiDoc source I could control which title to show in the <title> tag of the generated HTML doc (i.e. using the HTML5 backend specific attribute), but the chunker would still apply the same title to each split HTML file.

@wshito
Copy link
Owner

wshito commented Nov 11, 2021

Oh, excuse me. I thought you wanted to change the every single section title. Yes, I agree with you that there must be other users to prefer different styles. I reopen this issue. But I will most probably try to achieve this with themes.

@wshito wshito reopened this Nov 11, 2021
@wshito wshito added the enhancement New feature or request label Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants