Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Generating a HTML site map
A sitemap plugin (one that generates an HTML list of all articles in a site rather than a sitemaps.org XML file) would be super-duper.
Here’s hoping someone who is clever and generous will write one — if I ever do, I promise I’ll post about it…
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
Re: Generating a HTML site map
ALWAY happens that you answer something yourself when you’ve written about it…
I think this answers my question and perhaps some other peoples(?) – in which case I’m surprised we all missed it (probably we didn’t and I am being stoopid):
http://textpattern.com/faq/134/how-do-i-make-an-archive-page
PS: Just saw a typo on that page, where it says:
<li><txp:permlink><txp:title /></txp:title></li>
it means
<li><txp:permlink><txp:title /></txp:permlink></li>
Last edited by alanfluff (2008-09-15 22:23:33)
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
Re: Generating a HTML site map
johnstephens wrote:
I used the archive page tutorial as a starting point.
I actually saw that page and used it as my starting point. What I wanted, though, was a sitemap sorted by section with a link to each section’s landing page as a header at the top of each list of articles in that section— like this:
<hn><a href="/section-name">Section Title</a></hn>
<ul>
<li><a href="#article-permlink">Article Title</a></li>
<li><a href="#article-permlink">Article Title</a></li>
<li><a href="#article-permlink">Article Title</a></li>
</ul>
<hn><a href="/section-name">Section Title</a></hn>
<ul>
<li><a href="#article-permlink">Article Title</a></li>
<li><a href="#article-permlink">Article Title</a></li>
<li><a href="#article-permlink">Article Title</a></li>
</ul>
<!-- et cetera -->
This doesn’t seem to be possible under 4.0.6 (I could be wrong). Right now I’m using the section_list
tag.
Last edited by johnstephens (2008-09-16 01:35:45)
Offline
Re: Generating a HTML site map
Hey John,
This does exactly that for me:
in the page template (or wherever suits your site)
<ul>
<txp:article_custom limit=99999 form="my_sitemap" sortby="-custom_1" section="section-1, section-2, section-3"/>
</ul>
and in the form my_sitemap
<txp:if_different>
<h3><txp:section title=1 link=1 /></h3>
</txp:if_different>
<li><txp:permlink><txp:title /></txp:permlink></li>
I added the section-1, section-2, section-3
because I don’t want section-4
appearing in the site map. I sorted by the ‘-’ value in custom field 1
which I had already used to get the articles in the correct order in my main navigation and so now again in the site map.
Last edited by joebaich (2008-09-16 12:12:52)
Offline
Re: Generating a HTML site map
Wow, Joe. Thanks again!
Offline
Re: Generating a HTML site map
Sorry John, I didn’t realise you had already been to that resource — thanks for the explanation.
And thanks Joe – that looks like it might help me too!
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
#19 2008-09-16 15:05:43
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Generating a HTML site map
joebaich wrote:
This does exactly that for me:
OK, that works, but does the <h3>
belong inside a list? ;) What would be perfect – and what is not (yet) possible with if_different – is nested lists.
Offline
Re: Generating a HTML site map
Oo? I keep getting sections split up (Section, articles, Other section and articles then the first section again with remaining articles).
Oh well — ran out of time and for now have had to hard code (yuk).
But. Did wonder if it might be good to use DL in the page and DT and DDs in the form, this would solve the H3 inside a UL.
Wish I had time to explain that better, sorry not done so, will do again another time if not self-explanatory (but sure it is). Hope this thought is helpful.
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
#21 2008-09-16 22:06:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Generating a HTML site map
alanfluff wrote:
Oo? I keep getting sections split up (Section, articles, Other section and articles then the first section again with remaining articles).
You need to sort by section in the article tag.
Offline
Re: Generating a HTML site map
Thanks Els!
When I try this next site, I’ll see how the DL approach pans out too — I don’t think it’s a misuse of an HTML tag – still semantic (I think).
At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A
Offline
Re: Generating a HTML site map
Els,
You are absolutely right, h3 does look out of place in a UL and likely won’t validate. I think alanfluff is on a surer footing with the DL and that it likely will validate. I originally did the site map as an exercise on a live site but the client wasn’t sold on the idea of having one at all, so I moved on before dotting the i’s and crossing the t’s. I speak a bit of dog too, by the way.
Alan,
Can’t comment without seeing the code you tried other than to recall that sorting on a value in custom_1
in <txp:article_custom/>
seemed to be the key for me, I didn’t spend much time with sorting on sections because I needed the site map entries to appear in the same order as the main navigation. I used values like 100-199 for section-1, 200-299 for section_2 and so on to get the articles’ titles in the desired order in the main navigation which was based on a DL with a similar construction to the site-map. I will revisit the site map to see if I can adapt it to use the DL.
Last edited by joebaich (2008-09-17 03:48:16)
Offline
Re: Generating a HTML site map
Using definition lists could validate, but I wouldn’t call it semantic. Semantics is meaning, and dl
means “definition list.” Calling the names of articles in a section definitions of the section name is a bit of a stretch.
Using header elements is more semantically correct even if they’re improperly nested.
Offline