Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Generating a HTML site map
John,
Using definition lists could validate, but I wouldn’t call it semantic.
Dunno, using a list of article titles as definition descriptions [dd] to define the content of a Section, the title of which is expressed as a definition term [dt] seems reasonably semantic to me. How better to describe a section than to state succinctly what it contains? It’s all semantics isn’t it :-)!
Anyway,
<dl>
<txp:article_custom limit=99999 form="my_sitemap" sortby="-custom_1" section="section-1, section-2, section-3"/>
</dl>
and in the form my_sitemap
<txp:if_different>
<strong><dt><txp:section title=1 link=1 /></dt></strong>
</txp:if_different>
<dd><txp:permlink><txp:title /></txp:permlink></dd>
worked well for me; see below. It needs some styling and the inline quick and dirty <strong>
tab removed but illustrates the point.
Last edited by joebaich (2008-09-17 04:34:59)
Offline
Re: Generating a HTML site map
Joe
…sorting on a value in custom_1 in <txp:article_custom/> seemed to be the key for me…
Thanks Joe — I’ll check this next time.
John/Joe
Glad re: DL – I admit to a weakness for DL, I like to use it more rather than less liberally but hopefully I have not strayed too far outside it’s meaning (yet!). Cheers!
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
#27 2008-09-17 17:09:12
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Generating a HTML site map
johnstephens wrote:
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.
Interesting discussion. Does ‘semantically correct but invalid html’ precede ‘valid html but semantically incorrect’ or vice versa? Seriously, I’d like to know.
joebaich wrote:
I speak a bit of dog too, by the way.
(OT) My Dog is ‘read only’, but that’s not a problem since most dogs are very good at ‘read only’ Human :)
Offline
Re: Generating a HTML site map
…Interesting discussion. Does ‘semantically correct but invalid html’ precede ‘valid html but semantically incorrect’ or vice versa? Seriously, I’d like to know…
Els — I would be unhappy with either, but if I was told to go live on a desert island with only one or the other, the one I could get on best with is invalid HTML that is semantically correct because there I am ‘hurting’ the rules, the BOTS, etc, but I am passing the human reader more meaning, and that seems the top priority of content. Of course in the real world the human reader might not get to read it as my malformed HTML might cause too many other well formed web pages to be seen before mine in search engines, so I would become invisible.
I still have to say that I agree with Joe that this is not a case of ‘wrong’ use of DL (DT, DD), but I accept that if one is looking for perfect examples of DL usage, then perhaps this is not the best (nod to John’s comments). But compromise is so often necessary, and if it’s made with care then all should remain well.
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
#29 2008-09-17 17:35:50
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Generating a HTML site map
Alan, thanks for your view. I tend to agree on this
because there I am ‘hurting’ the rules, the BOTS, etc, but I am passing the human reader more meaning, and that seems the top priority of content.
but I’m not so sure if in this case you are really ‘passing the human reader more meaning’: human readers hardly ever look at markup, do they?
Offline
Re: Generating a HTML site map
…but I’m not so sure if in this case you are really ‘passing the human reader more meaning’: human readers hardly ever look at markup, do they?…
Yes, I agree completely.
However, I always think, when considering if I am passing on meaning, of the web page with all CSS turned off so the reader sees the content as it is meant to be rendered by the most basic rules (those built into the browser).
So in this case, assuming an H3 inside a UL would mis-align (guessing it would, not tested), and knowing how a DL would look, I believe more/clearer meaning would be transferred to the reader. Admittedly my imaginary reader in this case is either someone who has turned off CSS or any CSS present is not visually doing the opposite of the browsers built in rules for these tags.
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
I also use a DL-list for my archive page(s) using the same if_different principle. I sometimes also show it on the 404 page for added where-to-go-from-here help.
Getting sticky and live articles to show together is still a problem, though, as status="live,sticky"
is no longer possible. I’ve only managed this by hacking this facility back into the core. The traditional method of calling txp:article_custom
twice with status="sticky"
and a second time with status="live"
in combination with txp:if_different
results in duplicate section headings, effectively a sitemap of sticky articles and a sitemap of live articles.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Generating a HTML site map
I just tested both in a plain page with no styles, in Safari and Lynx (a plain text browser). In both cases I think the relationship is slightly more clear using the improperly nested header element, but not by a meaningful degree. I have to confess, that according to W3, this is a semantically valid use of the dl
element; check out their recipe example. In this case, the h3
/ dt
’s implied meaning is “contents of Section x,” which corresponds to “ingredients,” but it still looks like a nested unordered list would be more correct that several dt
s.
I would conclude that for this purpose, the dl
markup above is the best available option. But I would put the strong
tags inside the dt
.
Last edited by johnstephens (2008-09-17 18:43:51)
Offline
#33 2008-09-17 20:09:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Generating a HTML site map
Now here’s a challenge: how to create a list like this with if_different :)
<dl>
<dt><strong>The ingredients:</strong></dt>
<dd>
<ul>
<li>100 g. flour</li>
<li>10 g. sugar</li>
<li>1 cup water</li>
<li>2 eggs</li>
<li>salt, pepper</li>
</ul>
</dd>
<dt><strong>The procedure:</strong></dt>
<dd>
<ol>
<li>Mix dry ingredients thoroughly.</li>
<li>Pour in wet ingredients.</li>
<li>Mix for 10 minutes.</li>
<li>Bake for one hour at 300 degrees.</li>
</ol>
</dd>
<dt><strong>Notes:</strong></dt>
<dd>The recipe may be improved by adding raisins.</dd>
</dl>
Offline
Re: Generating a HTML site map
I wanted to bump this since Els posted an elegant solution to this problem on the TXP Tips site.
I added a second section_list
for site utilities, but I’m very happy with the results!
Thanks!
Offline