Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2020-09-27 10:32:51

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Hidden Section for PP and Terms of Service in Footer

Destry wrote #326091:

One thing I’m wondering…

Another minor hurdle is if wanting to link from one pageless section article to another, the equivalent of an in-page link. You just have to use the id selector as a target: <h2 id="id<txp:article_id />".

So if a ‘Methodology’ pageless-section article ID equaled 37, and one wanted to link from the text of that article to a ‘Conclusion’ article collated later having ID 39, the in-page link would be a relative "conclusion":#id39. Nothing new there.

But one has to know/remember what the respective destination component article IDs are, which are not immediately obvious in context of the Write panel, and if they don’t remember, it’s a jump to the Articles panel to recall. But, still doable.

Offline

#14 2020-09-27 10:44:05

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Hidden Section for PP and Terms of Service in Footer

etc wrote #326124:

You need to collate the articles first, then pass the collated block (stored in some <txp:variable />) to etc_query instead of <txp:body />

Ah. Variables. Again. Quite a missing detail for this simplton. Thank you. ;)

Offline

#15 2020-09-27 14:51:50

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Hidden Section for PP and Terms of Service in Footer

etc wrote #326124:

You need to collate the articles first…

It works. Pretty neat. I’m using this:

<txp:etc_query data='<txp:variable name="body" />' 
               query="//h2|//h3|//h4|//h5" 
               wraptag="ul" 
               break="li">
    <{#}><a href="#{@id?}">{?}</a></{#}>
</txp:etc_query>

But how can I change it so it doesn’t output the heading tags like this:
<li><h2>link</h2></li>?

I would prefer just <li>link</li>.

I tried looking at the plugin help, but it’s all a bit over me.

I don’t have any h3 headings, so no nested lists are needed in my case. But I can imagine other situations maybe having those, or lower levels, in which case someone might want nested list output. I think that’s how soo.toc works; changes heading elements to list items and nests them in the contents according to section levels.

Last edited by Destry (2020-09-27 14:57:09)

Offline

#16 2020-09-27 15:55:19

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Hidden Section for PP and Terms of Service in Footer

Destry wrote #326128:

It works. Pretty neat.

Ah, that’s great!

But how can I change it so it doesn’t output the heading tags like this:
<li><h2>link</h2></li>?

I would prefer just <li>link</li>.

Unwrap the links from <#>...</#> which represent the matched tags name (h2 etc).

I don’t have any h3 headings, so no nested lists are needed in my case. But I can imagine other situations maybe having those, or lower levels, in which case someone might want nested list output. I think that’s how soo.toc works; changes heading elements to list items and nests them in the contents according to section levels.

Yes, soo_toc certainly has more TOC-related features than a general-purpose plugin. Probably one can do it with etc_query, but this would need some more involved XPath. But you also could just style headings differently, depending on their levels, to mimic nested lists.

Offline

Board footer

Powered by FluxBB