Forum

Thread tagged as: Question, Problem, Configuration

Setting Page Attributes

I have this in the page attributes file:

<meta name="robots" content="<perch:pages id="noindex" label="Do not index" type="checkbox" value="noindex" append="," divider-before="Search engine indexing" /><perch:pages id="nofollow" label="Do not follow links" type="checkbox" value="nofollow" append="," /><perch:pages id="nosnippet" label="Do not show a snippet" type="checkbox" value="nosnippet" append="," />" />
  1. How do I set it so all the checkboxes are ticked on page creation? Currently I have to go in every page and do it manually. I am building landing pages I do not want indexed.

  2. Is there a way to also set "Hide from main navigation" to also be checked?

Nigel Coath

Nigel Coath 1 points

  • 4 days ago
Robert Ketter

Robert Ketter 95 points
Registered Developer

Nigel. You should make your options opt in rather then opt out.

Using checkbox always defaults to unchecked, and I don’t think there is the ability to default to checked in Perch.

The reason I want it set to off is these are Adwords landing pages and some of the content is very similar to organic pages.

Duncan Revell

Duncan Revell 70 points
Registered Developer

How about changing the checkbox to a radio button with yes/no options? Set the default value to no.

Surely that wont work? The code above is in the seo.html attributes template and the checkbox being set is the admin settings. I see there is an append="," is this not the thing controlling if its checked?

Duncan Revell

Duncan Revell 70 points
Registered Developer

The checkbox in the admin is being generated by the above code in seo.html. The attribute templates are the same as any other template in Perch - any html code in the template is output to your page and the perch:page tags create the admin controls.

Duncan Revell

Duncan Revell 70 points
Registered Developer

There's nothing to stop you creating your own seo.html template and doing something like

<perch:content id="index" type="radio" label="Index?" options="Yes, No" suppress="true" />
<perch:if id="index" value="No">noindex,</perch:if>