What is the best practice to list all H1 titles in markup language in sorted list?
If I use [TOC] - order is somehow random. Is there a better way to do it than manually write all links in file?
I am using creole as markup language on BitBucket.
The syntax there is
<<toc />>
which shows all the H1,H2 etc on the pages.
To sort the pages I am putting 1_,2_,3_,... in front of the page titles (not the H1 but the page title). In this way the page names are also numbered and organised.
You can also move files inside different directories and then create a table of content for each directory <>
Related
I have a lot of ASCII docs at different locations and I want to create an index page which should render these documents. But the condition here is that I want to list all the document link on the index page and if the user clicks on any link then only the document should be displayed. I don't want to display the documents below the table of content. I just want to display the table of content on the index page.
Is there any way to do this?
If I understand you correctly, you wish to generate a multi-document website, but you want an index page that displays just the TOC, with the other documents served elsewhere. I believe the best way to get this effect would be to generate chunked XHTML output using the DocBook toolchain. I believe this should be possible with Asciidoctor tools, but I have only implemented this particular post-rendering toolchain with the original (Python-based) AsciiDoc rendering tool, as documented here. This setup is configurable to generate a TOC index page that links to chunked output (you can configure the level of chunking).
As you have already figured out, AsciiDoc's automated TOC generation only works on the present document, which requires including the subordinate document to get their headings for the TOC. I can think of ways to sort of game this, such as to include just the heading of the included document (include::path/to/document.adoc[lines=1]) and then hiding even those headings with CSS or something. The problem is, the links in the TOC will be pointing internally, so you'd need to handle that somehow.
Another way is to use any of the static-site generators that support or can be readily extended to support AsciiDoc. What you're talking about is not an out-of-the-box feature that I'm aware of, but they all at least make it possible to generate an organized TOC-type navigation.
I'm using Github pages to build some pages with text I want to get from yaml files. At present I have two yaml files one each for a different car type. I want to use a drop down in the header to select a car type which will then inform which yaml file to get to repopulate the page with text specific to that car.
I can create the drop down which adds a query string param to the page. I can also iterate through the two yaml files and output specific variables. What I can't figure out is how to use the two together so that the yaml file for the page is informed by the user selection from the dropdown.
Or maybe there is a much better way of doing this??
Github pages uses Jekyll, a static site generator. Your site is built once when you push to your gh-pages branch. After that, your browser is just served the generated HTML pages. All the iterating over your YAML files is done at generation time, not when you request the pages. Since you have no server-side code that is executed when you change your dropdown, you cannot process a query parameter.
Since you cannot process query parameters, you need to place your cars on different URLs. Here's a simple example how to change URLs with a <select> and JavaScript, using the code from this answer:
<select name="" onchange="javascript:location.href = this.value;">
<option value="/mypage/car1/" selected>Car1</option>
<option value="/mypage/car2/">Car2</option>
</select>
Then you just need to generate the HTML pages for each car, located at /mypage/car1/ and /mypage/car2/ respectively. That can be done by using your YAML data as part of the YAML front matter. For example, this could be car1.md:
---
layout: car
permalink: /mypage/car1/
data: # data of your car here
name: my very awesome car
---
Markdown content here (leave empty if you don't need it)
You then create the layout _layouts/car.html and in it, generate the appropriate HTML page. For example, to show the car's name, do something like:
<label>Name:</label> {{page.data.name}}
To avoid JavaScript, you can also create a dropdown menu containing <a> links with pure HTML+CSS.
I am using blocks to create and share my d3 snippets. When I have more than one file, for example this block, the data.tsv the file appears second. It's a huge file, so if someone wants to see the javascript code he has to scroll all the way down.
My question is, is there any way to change the order in which files are displayed in blocks? It seems to not follow Github gist's alphabetical order as index.html appears before data.tsv. Or do I have to create just one index.html file and put all my javascript and CSS code in it? like most of the blocks do.
index.html is always listed first, then the other files are listed alphabetically. Something I'll prepend an _ to interesting files, like _script.js to force them to show up first.
I have a template which I'm filling with text. There is a header page, and several content pages after the header. Each content pages has two columns, and some logos and things at the bottom. I'm filling in the content dynamically with images and formatted text.
The number of pages is variable. How can I either duplicate content pages as needed, or (if I create a template with many pre-duplicated content pages) delete empty pages after filling in the content?
Well, you can add a page with myDoc.pages.add(...) and then duplicate the content.
To remove pages: myPage.remove().
But the question is somewhat vague, so it's hard to be more specific.
there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.