0
|
1 <macro name="change_title_and_meta_tags" requires="servlet">
|
|
2 <n.node_page.>
|
|
3 <n.if.not.visitor.is_site_admin>
|
|
4 <then>
|
|
5 <n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
|
|
6 </then>
|
|
7 </n.if.not.visitor.is_site_admin>
|
|
8
|
|
9 <n.if.is_submitted_form>
|
|
10 <then>
|
|
11 <n.if.has_custom_values_field.is_checked>
|
|
12 <then>
|
|
13 <n.page_node.set_property name="page_title" value="[n.page_title_field.value/]"/>
|
|
14 <n.page_node.set_property name="page_meta_description" value="[n.page_meta_description_field.value/]"/>
|
|
15 </then>
|
|
16 <else>
|
|
17 <n.page_node.delete_property name="page_title"/>
|
|
18 <n.page_node.delete_property name="page_meta_description"/>
|
|
19 </else>
|
|
20 </n.if.has_custom_values_field.is_checked>
|
|
21 <n.redirect_to.page_node.path/>
|
|
22 </then>
|
|
23 <else>
|
|
24 <n.has_custom_values_field.set_value value="[n.page_node.has_custom_meta_tags/]"/>
|
|
25 <n.page_title_field.set_value.property_default property="page_title" default="[n.page_node.default_title_contents/]"/>
|
|
26 <n.page_meta_description_field.set_value.property_default property="page_meta_description" default="[n.page_node.default_meta_description/]"/>
|
|
27 </else>
|
|
28 </n.if.is_submitted_form>
|
|
29 <n.html>
|
|
30 <head>
|
|
31 <meta name="robots" content="noindex,nofollow"/>
|
|
32 <n.title.><t>Change title and meta tags</t></n.title.>
|
|
33 <style type="text/css">
|
|
34 textarea {
|
|
35 margin:.4em 0 2em;
|
|
36 width:40em;
|
|
37 height:3em;
|
|
38 }
|
|
39 </style>
|
|
40 <script type="text/javascript">
|
|
41 var txt_counter = '<t>Current length: <t.number>#1</t.number> characters</t>';
|
|
42 function updateCounters(){
|
|
43 $('textarea').each(function() {
|
|
44 var $textarea = $(this);
|
|
45 $textarea.prev().html(txt_counter.replace(/#1/, $textarea.val().length));
|
|
46 });
|
|
47 };
|
|
48
|
|
49 function enableFields() {
|
|
50 var checked = $('#has_custom_values').is(':checked');
|
|
51 var $fields = $('#page_title,#page_meta_description');
|
|
52 if (checked) {
|
|
53 $('textarea').keyup(updateCounters);
|
|
54 $fields.removeAttr('disabled');
|
|
55 $fields.eq(0).focus();
|
|
56 } else
|
|
57 $fields.attr('disabled', true);
|
|
58 };
|
|
59 $(document).ready(function() {
|
|
60 enableFields();
|
|
61 updateCounters();
|
|
62 $('#has_custom_values').click(enableFields);
|
|
63 });
|
|
64 </script>
|
|
65 </head>
|
|
66 <body>
|
|
67 <n.edit_header first_text="[n.page_node.subject/]" second_text="[t]Change title and meta tags[/t]" />
|
|
68 <div class="weak-color" style="margin:1em 0">
|
|
69 <t>Here you can customize the title and meta tags of the <t.location><i><n.page_node.subject/></i></t.location> page.</t>
|
|
70 <t>The meta information below can help you optimize this page for search engines (e.g., google, yahoo!, etc.).</t>
|
|
71 </div>
|
|
72 <n.form.>
|
|
73 <div style="margin:1em 0 0;">
|
|
74 <n.has_custom_values_field.checkbox />
|
|
75 <label for="[n.has_custom_values_field.name/]" class="big-title second-font"><t>Use custom values</t></label><br/>
|
|
76 </div>
|
|
77
|
|
78 <div style="margin:1em 0 0 3em">
|
|
79 <div class="big-title second-font"><t>Page Title</t></div>
|
|
80 <div class="weak-color"><t>Enter a context-rich title that clearly identifies this page.</t></div>
|
|
81 <div class="weak-color"><t>The title should ideally be less than 70 characters in length.</t></div>
|
|
82 <div class="weak-color"></div>
|
|
83 <n.page_title_field.textarea maxlength="100"/>
|
|
84
|
|
85 <div class="big-title second-font"><t>Meta Description</t></div>
|
|
86 <div class="weak-color"><t>Enter a brief and concise summary of your page's content.</t></div>
|
|
87 <div class="weak-color"><t>Limit your description to 155 characters or 170 characters at most.</t></div>
|
|
88 <div class="weak-color"></div>
|
|
89 <n.page_meta_description_field.textarea maxlength="250"/>
|
|
90 </div>
|
|
91
|
|
92 <div>
|
|
93 <input type="submit" class="toolbar action-button" value="[t]Save Changes[/t]" />
|
|
94 <t>or</t> <a href="[n.page_node.path/]"><t>Cancel</t></a>
|
|
95 </div>
|
|
96 </n.form.>
|
|
97 </body>
|
|
98 </n.html>
|
|
99 </n.node_page.>
|
|
100 </macro>
|
|
101
|
|
102 <macro name="has_custom_meta_tags" requires="node">
|
|
103 <n.both>
|
|
104 <condition1.has_property name="page_title"/>
|
|
105 <condition2.has_property name="page_meta_description"/>
|
|
106 </n.both>
|
|
107 </macro>
|
|
108
|
|
109 <macro name="property_default" parameters="property, default">
|
|
110 <n.if.page_node.has_property name="[n.property/]">
|
|
111 <then.page_node.get_property name="[n.property/]"/>
|
|
112 <else.compress.default/>
|
|
113 </n.if.page_node.has_property>
|
|
114 </macro>
|
|
115
|
|
116 <macro name="default_title_contents" requires="node">
|
|
117 <n.if.is_app>
|
|
118 <then.default_app_title_contents/>
|
|
119 <else.default_topic_title_contents/>
|
|
120 </n.if.is_app>
|
|
121 </macro>
|
|
122
|
|
123 <macro name="change_title_and_meta_tags_link" requires="node" dot_parameter="text" parameters="title, class">
|
|
124 <a href="[n.change_title_and_meta_tags_path/]" class="[n.class/]" rel="nofollow" title="[n.title/]"><n.default. to="[t]Change title and meta tags[/t]"><n.text/></n.default.></a>
|
|
125 </macro>
|
|
126
|
|
127 <macro name="change_title_and_meta_tags_path">
|
|
128 <n.encode_url.>
|
|
129 /template/NamlServlet.jtp?macro=change_title_and_meta_tags&node=<n.id/>
|
|
130 </n.encode_url.>
|
|
131 </macro>
|
|
132
|
|
133 <macro name="page_title_field" dot_parameter="do">
|
|
134 <n.field. name="page_title"><n.do/></n.field.>
|
|
135 </macro>
|
|
136
|
|
137 <macro name="page_meta_description_field" dot_parameter="do">
|
|
138 <n.field. name="page_meta_description"><n.do/></n.field.>
|
|
139 </macro>
|
|
140
|
|
141 <macro name="has_custom_values_field" dot_parameter="do">
|
|
142 <n.field. name="has_custom_values"><n.do/></n.field.>
|
|
143 </macro> |