Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-09-01 12:55:14

marios2
Member
From: Germany
Registered: 2019-07-31
Posts: 76

Hidden Section for PP and Terms of Service in Footer

I am Working on a small Site for a local landmark in the Woods for my Brother in Law. The Site is finished so far, but I want to have a hidden Section, which does not appear in the Main Menu, so I can publish two articles for PP and TofS in the footer.

What’s the best way to go about this?

Thanks, Marios

Offline

#2 2020-09-01 13:07:30

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

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

Hi Marios,
A headless section might be your best bet for this one. Alternatively you can just use <txp:section_list exclude="your_section" /> for the navigation.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2020-09-01 22:05:17

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

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

colak wrote #325710:

A headless section might be your best bet for this one.

That would be a good option, but be aware, it’s called a “pageless” section. There’s a recent Textpattern blog article on this topic.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2020-09-24 15:29:29

marios2
Member
From: Germany
Registered: 2019-07-31
Posts: 76

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

Thank you guys.

Issue resolved.

rgrds, Marios.

Offline

#5 2020-09-24 16:02:35

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

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

This scenario is a good idea. It has me thinking of another one.

My current About article for the glossary project is composed of several necessarily long-ish h2 sections. I think I’d rather write these sections as smaller composite articles to collate together, but I don’t want bots and boobs scraping up URLs for them. Seems like a pageless section would be good, then assemble the pieces in the About section.

/Later that evening/

Have tested this a bit and it does work as prescribed. One unforeseen setback was that I use soo_toc for adding useful Contents lists at tops of long, sectioned articles like this so people can jump to the bit they’re inquiring about. I can add the needed IDs easily enough (<h2 id="id<txp:article_id />">) but unfortunately the plugin tag still doesn’t pick up the collated ghost articles as article sections. I can manually create the contents list, I guess. Always like herding cats, though.

Last edited by Destry (2020-09-24 16:49:46)

Offline

#6 2020-09-25 14:44:38

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

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

Still piggy-backing this thread, if nobody minds, as it’s closely relevant and seems better than starting a new thread for which I don’t really have a question. (I know, rare.)

It occurred to me that an article list could serve as the TOC I mentioned previously, and, in fact, is works nicely, so I thought I’d throw it on the table for anyone still needing/wanting a pageless section example to think about.

As mentioned, I’ll have a main About article with many largish subsections. About content is something I spend way too much time/effort fussing over, editing it endlessly over time. So one long-ass article (as this project seemingly requires) is kind of pain in that situation. A pageless section can help, as I see it, by breaking up those sections into discrete articles without them being found as separate published articles. Editing/revising is easier when facing just 2 or 3 paras at a time. But, again, I don’t want to sacrifice the auto-generated contents list for the collated About webpage.

So I have two sections:

  • about
  • aboutish

About gets assigned a page and a single article that serves as the head article to which the other about content pieces will be appended. Aboutish is assigned no page (the blank option) and is where all other sub-articles are assigned.

At the very top of the sole about section article I have:

<txp::contents_aboutish />

<txp:article_custom section="aboutish" form="aboutish_articles" sort="posted" />

The first one, a short-tag, outputs the makeshift contents list (i.e. a ToC). Here is its associated contents_aboutish ‘shortform’:

<section class="">
  <header>
    <h1>Contents</h1>
  </header>
  <txp:article_custom section="aboutish" form="aboutish_contents" wraptag="ul" break="li" />
</section>

And here’s the aboutish_contents form in turn:

<a href="#id<txp:article_id />"><txp:title escape="tidy,textile" /></a>

The article_custom tag outputs the discrete About topic articles from the Aboutish section, effectively appending them all together as a single-looking article. The aboutish_articles form:

<h2 id="id<txp:article_id />"><txp:title escape="tidy, textile" /></h2>
<txp:body escape="trim, tidy" />

The contents list is generated from the titles of the discreet articles in the order appended. The article IDs are used to create the in-page anchor links.

Of course, rename all these forms to whatever you want, if you want.

This isn’t a perfect replacement to the soo_toc plugin, because you can’t control the number of levels in the contents list, I don’t think (due to needing the IDs), but in this case I don’t need anything deeper than the first level titles, and in any case the plugin doesn’t work with pageless sections. So a working compromise.

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

Offline

#7 2020-09-25 14:52:08

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

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

One thing I’m wondering, seeing in advance — another common editing situation — is needing to rearrange the collation order of the discrete article pieces (equivalent to moving article sections around during developmental editing), and how, if at all, Txp will allow that since the order could be anything the editor may deem needed.

/Later/

Oh, wait, if the order is determined by date of publication, then one can simply change the article publish date for the pageless section articles. That would work. Not tested.

/Still later/

Okay, that works, but I had to go back and add sort="posted" to both the article_custom tag used at the top of the head article’s body field and to the same tag used in the contents_aboutish form.

Last edited by Destry (2020-09-27 11:06:35)

Offline

#8 2020-09-25 15:46:08

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

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

Extracting a TOC from <txp:body /> (or whatever HTML block) is fairly easy, putting this in an article form:

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

Offline

#9 2020-09-25 16:42:36

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

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

I need to grab etc_query, but your site is not loading, and it’s not here. :{

Offline

#10 2020-09-25 16:47:53

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

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

Here it is.

Offline

#11 2020-09-27 09:57:36

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 #326092:

Extracting a TOC from <txp:body /> (or whatever HTML block) is fairly easy…

Just to be clear, are you proposing this in context of pageless sections, where many articles are being collated, as I was talking about above? If so, I’m not getting it to work. (Though I don’t think I need to use it anyway as I have it working without the plugin.)

Or just as an alternative to soo_toc under normal section/publishing conditions? In this sense it would be good to know. In this context, if I understand right, the query would go in the article form defining the full article output? Something like this?

<article>
<h1><txp:title /></h1>
. . .
<txp:if_excerpt>
  <p class=""><txp:excerpt /></p>
</txp:if_excerpt>

<txp:if_article_image>
  . . .
</txp:if_article_image>

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

<txp:body />
</article>

Or does it have to go in its own form, then the form is called with output_form tag in the top of an article’s body field?

Last edited by Destry (2020-09-27 10:00:09)

Offline

#12 2020-09-27 10:12:56

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

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

Destry wrote #326122:

Just to be clear, are you proposing this in context of pageless sections, where many articles are being collated, as I was talking about above? If so, I’m not getting it to work.

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

<article>
<txp:variable name="body">
...aggregated articles...
</txp:variable>

...images and so on...

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

<txp:variable name="body" />
</article>

Yes, it goes into the article form, though you can split it in many output_forms if needed.

Offline

Board footer

Powered by FluxBB