# Sitemap doesn't validate

**URL:** <https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719>\
**Category:** Radiant CMS\
**Created:** [November 9, 2007, 3:07pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719 "2007-11-09T15:07:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 3:07pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/1 "2007-11-09T15:07:32Z")

</div>

Hi,

I created a sitemap using the method described here:  
[http://wiki.radiantcms.org/How\_To\_Make\_a\_Sitemap](http://wiki.radiantcms.org/How_To_Make_a_Sitemap)

I’ve been very happy with the result. But recently I started cleaning  
up my xhtml to make it validate, and I find that there is a problem  
with the sitemap page. The sitemapper snippet creates a

 whether  
or not the current page has children. A 
 with no - children  
does not pass the w3c validation (I’m on XHTML 1.0 strict).

I propose that modifying the sitemapper snippet along the following  
lines would fix this:

\<r:children:each by=“title” order=“asc”\>  
\<r:unless\_content part=“no-map”\>

  -   
\<r:link /\>  
\<r:has\_child\>  

  
\<r:snippet name=“sitemapper” /\>  

  
\</r:has\_child\>  
  
\</r:unless\_content\>  
\</r:children:each\>

The block inside \<r:has\_child\> would only render if the current page  
had one or more child pages with status=published.

Currently, there is no tag equivalent to \<r:has\_child\>, as far as I  
know. There are tags \<r:parent /\> and \<r:unless\_parent /\>. If such a  
tag was to be created, it would probably be useful to create its  
opposite as well, e.g \<r:has\_no\_child\> or \<r:childless\>. (Any  
thoughts as to how the pair of tags should be named?)

Should I create a trac ticket for this? Or am I missing something?

Cheers,

Andrew

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 3:21pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/2 "2007-11-09T15:21:02Z")

</div>

Andrew,

They shouldn’t be hard to implement. Have a look at the definitions for  
\<r:parent\> and \<r:if\_parent\> in standard\_tags.rb.

Sean

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 3:35pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/3 "2007-11-09T15:35:04Z")

</div>

On 9 Nov 2007, at 14:19, Sean C. wrote:

> Andrew,
> 
> They shouldn’t be hard to implement. Have a look at the  
> definitions for  
> \<r:parent\> and \<r:if\_parent\> in standard\_tags.rb.

I thought so too.

I can easily roll this out as an extension, but I wonder whether it  
should really go into the core? I’ll have a go at creating the tags  
and tests myself. When done, I’ll also update the howto page.

As for the naming of these tags, what sounds most idiomatic:

\<r:if\_children\> and \<r:unless\_children\>  
\<r:has\_children\> and \<r:has\_no\_children\>  
\<r:is\_parent\> and \<r:is\_childless\>

I’m favouring the first.

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 4:14pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/4 "2007-11-09T16:14:27Z")

</div>

> As for the naming of these tags, what sounds most idiomatic:
> 
> \<r:if\_children\> and \<r:unless\_children\>  
> \<r:has\_children\> and \<r:has\_no\_children\>  
> \<r:is\_parent\> and \<r:is\_childless\>
> 
> I’m favouring the first.

So am I, as it resembles the other tags in the core. If you can get a  
patch with thorough tests to me today via Trac, I can get it into 0.6.4.

Sean

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 5:44pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/5 "2007-11-09T17:44:00Z")

</div>

Andrew N. wrote:

> Currently, there is no tag equivalent to \<r:has\_child\>, as far as I  
> know. There are tags \<r:parent /\> and \<r:unless\_parent /\>. If such a  
> tag was to be created, it would probably be useful to create its  
> opposite as well, e.g \<r:has\_no\_child\> or \<r:childless\>. (Any  
> thoughts as to how the pair of tags should be named?)

A while back I mocked up an extension that abstracted conditionals. I  
like having a test for children as Andrew suggests but does anyone else  
think it would be useful to have a general \<r:if\> radius tag so that  
things like this could be added without cluttering up the number and  
variety of default if\_tags out there?

So instead of:  
\<r:if\_parent\>  
\<r:if\_content\>  
\<r:if\_children\>  
\<r:if\_next\_great\_idea\>

you’d have something like:  
\<r:if cond=“parent”\> or, maybe \<r:if cond=“page.parent exists?”\>  
\<r:if cond=“parts”\>  
\<r:if cond=“children”\>

It’s not my suggested syntax that I’m so concerned about here as the  
concept of keeping all the \<r:if\_stuff\> code DRY and reducing the number  
and complexity of all the different tags for the user. I’m guessing  
that this won’t be the last conditional radiant adds.

Oh, and to answer your question Andrew. I think that existence-test  
tags in radius are usually named like:  
\<r:if\_children\> and \<r:unless\_children\> or,  
\<r:if\_child\> and \<r:unless\_child\>

Of course you could also go with the King James Translation:  
\<r:if\_withchild\> and \<r:if\_barren\> 🙂

-Chris

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 6:14pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/6 "2007-11-09T18:14:25Z")

</div>

Chris P. said the following on 11/09/2007 11:42 AM:

> things like this could be added without cluttering up the number and  
> \<r:if cond=“parts”\>  
> \<r:if cond=“children”\>
> 
> It’s not my suggested syntax that I’m so concerned about here as the  
> concept of keeping all the \<r:if\_stuff\> code DRY and reducing the number  
> and complexity of all the different tags for the user. I’m guessing  
> that this won’t be the last conditional radiant adds.

Having a  
\<r:if … \>  
makes a lot of sense, not just from the POV of DRY, but as a good user  
interface. You only have to learn one way of doing things.

However it needs to be implement COMPLETELY, that is it needs to be able  
to  
support the full range of conditionals and booleans.

At the risk of seeming heretical, the Wiki project ‘TWiki’ has this  
feature  
‘done right’, although its context is somewhat different. However the

```
<r:if (cond= and cond= ) or cond= >

```

type syntax would be great!

And why shouldn’t the conditional inspect the environment, for example,  
to  
determine if this is a http or https connection?

The idea of having a ruby expression in the conditional that returns  
true or  
false would make it very powerful at the cost of introducing a security  
hazzard.

Oh and don’t forget the “else” !

[http://twiki.org/cgi-bin/view/TWiki/IfStatements](http://twiki.org/cgi-bin/view/TWiki/IfStatements)

/anton

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 6:36pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/7 "2007-11-09T18:36:40Z")

</div>

Andrew,

The mailing list strips attachments. Please file a ticket on the Trac  
at [http://dev.radiantcms.org](http://dev.radiantcms.org).

Sean

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/8 "2007-11-09T19:30:34Z")

</div>

Check the backdoor extension at [http://backdoor.rubyforge.org/](http://backdoor.rubyforge.org/) .

```
Also search this list for "backdoor" for discussions about what you

```

comment, current security issues with backdoor, alternatives, etc…

```
Regarding making Radiant "more programmable", my opinion is that the 

```

way  
to go is: proper ACL support + sandoxed-and-ACL-aware backdoor like  
functionality + proper Radiant object model documentation.

```
/AITOR

```

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/9 "2007-11-09T18:33:44Z")

</div>

Sean,

> If you can get a patch with thorough tests to me today via Trac, I  
> can get it into 0.6.4.

Here it is. I went with \<r:if\_children\> and \<r:unless\_children\> in  
the end. Let me know if you have any trouble with the patch.

Cheers,

Drew

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 13, 2007, 12:16am UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/10 "2007-11-13T00:16:18Z")

</div>

> I’ll have a go at creating the tags and tests myself. When done,  
> I’ll also update the howto page.

The tags \<r:if\_children/\> and \<r:unless\_children/\> are included in  
the latest release of Radiant (0.6.4). Just to wrap up this thread, I  
updated the how to: [http://wiki.radiantcms.org/How\_To\_Make\_a\_Sitemap](http://wiki.radiantcms.org/How_To_Make_a_Sitemap)

Cheers,

A

---

<div class="post-metadata">

**Author:** ![andrewneal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4491bb/32.png) [@andrewneal](https://www.ruby-forum.com/u/andrewneal)\
**Post date:** [November 9, 2007, 7:56pm UTC](https://www.ruby-forum.com/t/sitemap-doesnt-validate/119719/11 "2007-11-09T19:56:53Z")

</div>

> The mailing list strips attachments. Please file a ticket on the Trac

Done: [http://dev.radiantcms.org/radiant/attachment/ticket/575/](http://dev.radiantcms.org/radiant/attachment/ticket/575/)  
add\_conditional\_children\_tags.diff
