SeoTopicEditTemplate
Editor for SeoTopics

28 January 2025 - 12:46 | Version 1 |

%TMPL:INCLUDE{"Applications.ClassificationApp.ClassifiedTopicEdit"}%

%TMPL:DEF{"validationrules"}% {'MetaDescription': {maxlength:160}} %TMPL:END%

%TMPL:DEF{"formfields"}%%TMPL:P{"categoriestab"}%%TMPL:P{"tagstab"}%%TMPL:P{"seotab"}%%TMPL:END%

%TMPL:DEF{"seotab"}%%TAB{"%TRANSLATE{"SEO"}%"}%
%RENDERFOREDIT{"%BASEWEB%.%BASETOPIC%"
  form="%TMPL:P{"formdefinition"}%"
  fields="HTMLTitle, MetaKeywords, MetaDescription, MetaImage"
  HTMLTitle_title="%TRANSLATE{"HTML Title"}%"
  MetaKeywords_title="%TRANSLATE{"Meta keywords"}%"
  MetaDescription_title="%TRANSLATE{"Meta desciption"}%"
  MetaImage_title="%TRANSLATE{"Meta Image"}%"
}%
%ADDTOZONE{"script" 
   text="<script src='%PUBURLPATH%/Applications/ClassificationApp/SeoTopicEditTemplate/seo-topic-edit.js'></script>" 
   id="SEOTOPICEDIT::JS"
   requires="JQUERYPLUGIN"
}%%ENDTAB%%TMPL:END%

%STARTATTACH{"seo-topic-edit.js" hidecontent="on"}% "use strict"; jQuery(function($) { $(document).on("click", "#clsGenerateTitle", function() { var title = $("input[name=TopicTitle]").val() + " - %" + "WIKITOOLNAME%"; $(this).parents(".foswikiFormStep:first").find("input").val(title); return false; });

$(document).on("click", "#clsGenerateDescription", function() { var $field = $(this).parents(".foswikiFormStep:first").find("textarea"), description = $("input[name=Summary]").val();

if (description) { description = $("#topic").val(); }

$field.val(description.replace(/<[^>]*>/g, "").replace(/\n\s*\n/g, "").substr(0, 160)); return false; });

$(document).on("click", "#clsGenerateKeywords", function() { var $field = $(this).parents(".foswikiFormStep:first").find("input"), keywords = [];

$("input[name=Tag], input[name=Category]").each(function() { var vals = $.trim($(this).val()).split(/\s*,\s*/); $.each(vals, function(index, val) { val = val.replace(/Category$/, ""); if (val) { keywords.push(val); } }); });

$field.val(keywords.join(", ")); return false; }); }); %ENDATTACH%
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Middle Fork Home Wiki? Send feedback
Syndicate this site RSS