venerdì 30 dicembre 2016

Impostare la home per rispondere senza nome nell'URL

Per impostare la home/root così che risponda senza alcun nome di pagina nell'URL è necessario agire sui Settings, in particolare:

Settings -> URLs and SEO -> SEO - URLs -> Default page



Selezionando Domain Root si ottiene un url di default del tipo:
  • http://nomesito.it/
e non più:
  • http://nomesito.it/home.aspx

Fonte: http://devnet.kentico.com/questions/homepage-url

venerdì 4 novembre 2016

Mostrare il contenuto di una Editable Text dentro una Transformation ASCX

Possiamo mostrare il contenuto di una Editable Text all'interno di una transformation di tipo ASCX in questo modo:

<%# GetEditableValue("wET") %>

dove "wET" è il Control ID della Editable Text.


Tradurre "enter security code" del captcha


// In Kentico 8 - 9 

  • Localization --> Resource strings
Cliccare su New String, inserire nel campo Key la stringa: securitycode.lblsecuritycode e sotto le traduzioni

Traduzione captcha kentico

Cliccare Save. Risultato:


// In Kentico < 8 

  • Site Manager --> Development --> UI cultures
Cliccare su New string e inserire come Key "securitycode.lblsecuritycode" e sotto il testo custom. Questo sarà il testo di default per tutte le lingue, per questo probabilmente è più opportuno reinserire la label in inglese.
Cliccare poi sulla tab All cultures, cliccare sul tasto modifica della lingua desiderata.
Cercando la Key "securitycode.lblsecuritycode" apparirà la stringa appena creata. Cliccando su modifica si può inserire il testo tradotto.

mercoledì 31 agosto 2016

Font icone disponibile in Kentico 8/9

Il backend di Kentico 8-9 utilizza per le icone un font custom che può essere utilizzato anche da noi.

Ad esempio nella creazione di un nuovo Page Type è possibile e consigliato aggiungere una icona al tipo di contenuto. Per farlo è possibile caricare anche delle immagini, ma è più pratico e semplice utilizzare una delle tante icone messe a disposizione da Kentico stesso.

La lista completa con anteprima e relativa classe la trovate qui:

Macro per stampare un titolo in un campo solo se il campo è valorizzato nel database

Macro per stampare un titolo in un campo solo se il campo è valorizzato nel database

  {% if (ContainerTitle != "") { %}
    <h2>{% ContainerTitle %}</h2>
  {% } #%}

lunedì 22 agosto 2016

Kentico checklist

Ho trovato questa interessante e completa checklist per verificare la corretta messa in produzione di un sito web che utilizza Kentico

http://www.mmtdigital.co.uk/MMTDigital/media/Images/Ilesh-Blog/KenticoConnection/Kentico-Site-Delivery-Checklist.pdf

Controllare la visibilità di una webpart da un valore nella querystring o dal nome del documento

 Per controllare la visibilità di una webpart da un valore nella querystring è necessario inserire una macro nel campo Visibile:

{% if ( QueryString["show-webpart"] == "true" ) { return true; } else { return false; } #%}

Così se richiamando la pagina è presente un campo "show-webpart" con valore true allora sarà mostrata la relativa webpart

Se invece si vuol far controllare la visiblità al nome del documento visualizzato:

{% if ( CurrentPageInfo.DocumentName == "Foo Bar" ) { return true; } else { return false; } #%}

Fonte:
http://biznetdigital.net/kentico-cms-conditionally-handling-visibility-of-web-parts-using-k/

martedì 16 agosto 2016

Come formattare data e ora in una transformation

Se si utilizza un campo Data all'interno del codice di una trasformazione come in questo esempio:

 <%# Eval("DateField") %>

il suo formato standard di stampa sarà:

16/08/2016 00:00:00

Ma se vogliamo stampare solo la data o un diverso formato?

Sarà sufficiente utilizzare questo comando:

FormatDateTime(Eval("DateField"), "dd MMMM yyyy - hh:mm:ss tt ")

e scegliere il formato necessario secondo questa convenzione.

Il risultato in questo caso sarà:

16 August 2016 - 12:12 AM

Fonte: https://devnet.kentico.com/forums/f49/t28220/date-and-time-format

martedì 2 agosto 2016

Modificare il Title Prefix a seconda della lingua

Procedura:
  • Site Manager --> Settings --> Content
Nel campo  "Page Title Prefix" inserire una macro di localizzazione del tipo: {$title_prefix$}

Poi da:
  • Site Manager --> Development --> UI Cultures 

popolare la stringa con le traduzioni necessarie.

mercoledì 27 luglio 2016

Condizione IF nelle macro e in K# ASCX

Per utilizzare la condizione IF nelle macro è necessario questo codice:

{% DocumentContext.CurrentDocument.YoutubeVideo  == "" ? "" : "<div class='responsive-video'><iframe width='420' height='315' src='https://www.youtube.com/embed/" + DocumentContext.CurrentDocument.YoutubeVideo + "' frameborder='0' allowfullscreen></iframe></div>" #%}

In questo esempio viene valutato il campo custom "YoutubeVideo" e se è vuoto viene eseguita la prima azione, cioè niente. Se invece il campo è valorizzato viene stampato il codice HTML della seconda parte. Questo codice ha a sua volta una parte dinamica che è formata dal valore stesso del campo che va a comporre l'url definitivo del video di Youtube.

Invece la stessa condizione per i template ASCX si scrive:

<%# IfEmpty(Eval("YoutubeVideo"),"", "<div class='responsive-video'><iframe width='420' height='315' src='https://www.youtube.com/embed/" + Eval("YoutubeVideo") + "' frameborder='0' allowfullscreen></iframe></div>") %>

Aggiungere una classe al body tramite un template

Se si vuole aggiungere una classe al body per tutte le pagine di uno specifico template è necessario aggiungere il seguente codice nel layout del template stesso:

<script runat="server">
  protected void Page_Load(object sender, EventArgs e)
  {
    Page.DataBind();
    CMS.DocumentEngine.DocumentContext.CurrentBodyClass += " your-class";
  }
</script>

Non è importante se in cima o in fondo al codice stesso.

Fonte:
http://dahlindevelopment.com/blog/november-2015/add-a-css-class-to-the-body-tag-in-kentico/

mercoledì 8 giugno 2016

Utilizzare il content staging con file di grandi dimensioni

C'è un limite alla dimensione dei file che possono essere spostati in content staging.

In caso di superamento di questo limite viene restituito un errore molto criptico:
 HTTP status 404: Not Found

Si può rimuovere questa limitazione seguendo questa guida:
 Attenzione anche a questo:
Important: The binary data of files only forms a part of the synchronization requests. You may need to set a higher maximum value than the file size that you wish to allow.

giovedì 26 maggio 2016

Tutorial su come usare le macro

Breve e interessante tutorial su come usare le macro su Kentico:
Da cui ho elaborato un esempio reale di controllo dei campi dipendenti  sui BizForm

if (Tipologia_utente.Value == "Privato" || Tipologia_utente.Value == "Professionista") {return false;} else {return true;}

Lista delle espressioni macro

Constant macros

ApplicationPath
Syntax: {%applicationpath%}
Returns: UrlHelper.GetApplicationPath().TrimEnd('/') - Application path
AppPath
Syntax: {%apppath%}
Returns: UrlHelper.GetApplicationPath().TrimEnd('/') - Application path
CurrentCulture
Syntax: {%currentculture%}
Returns: CultureHelper.GetPreferredCulture() - Current culture
CurrentDate
Syntax: {%currentdate%}
Returns: DateTime.Now.ToShortDateString()
CurrentDateTime
Syntax: {%currentdatetime%}
Returns: DateTime.Now
CurrentTime
Syntax: {%currenttime%}
Returns: DateTime.Now.ToShortTimeString()
CurrentUrl
Syntax: {%currenturl%}
Returns: UrlHelper.CurrentURL - Current URL (new in 5.5)
Domain
Syntax: {%domain%}
Returns: UrlHelper.GetCurrentDomain() - Domain
EmptyString
Syntax: {%EmptyString%}
Returns: String.Empty
Ip
Syntax: {%ip%}
Returns: HTTPHelper.GetUserHostAddress() - Client's IP address
Now
Syntax: {%now%}
Returns: DateTime.Now
Pi
Syntax: {%Pi%}
Returns: Math.PI
Zero
Syntax: {%Zero%}
Returns: 0
Example: {%Zero|(add)5%}

Context macros

CMSContext.CurrentAttachment
Syntax: {%cmscontext.currentattachment%}
CMSContext.CurrentDocument
Syntax: {%cmscontext.currentdocument%}
CMSContext.CurrentDocumentCulture
Syntax: {%cmscontext.currentdocumentculture%}
CMSContext.CurrentDocumentOwner
Syntax: {%cmscontext.currentdocumentowner%}
CMSContext.CurrentDocumentParent
Syntax: {%cmscontext.currentdocumentparent%}
CMSContext.CurrentPageInfo
Syntax: {%cmscontext.currentpageinfo%}
CMSContext.CurrentSite
Syntax: {%cmscontext.currentsite%}
CMSContext.CurrentTemplate
Syntax: {%cmscontext.currenttemplate%}
CMSContext.CurrentUser
Syntax: {%cmscontext.currentuser%}
CommunityContext.CurrentFriend
Syntax: {%communitycontext.currentfriend%}
CommunityContext.CurrentFriendship
Syntax: {%communitycontext.currentfriendship%}
CommunityContext.CurrentGroup
Syntax: {%communitycontext.currentgroup%}
ECommerceContext.CurrentCurrency
Syntax: {%ecommercecontext.currentcurrency%}
ECommerceContext.CurrentCustomer
Syntax: {%ecommercecontext.currentcustomer%}
ECommerceContext.CurrentCustomerCountry
Syntax: {%ecommercecontext.currentcustomercountry%}
ECommerceContext.CurrentCustomerState
Syntax: {%ecommercecontext.currentcustomerstate%}
ECommerceContext.CurrentExchangeRate
Syntax: {%ecommercecontext.currentexchangerate%}
ECommerceContext.CurrentProduct
Syntax: {%ecommercecontext.currentproduct%}
ECommerceContext.CurrentProductDepartment
Syntax: {%ecommercecontext.currentproductdepartment%}
ECommerceContext.CurrentProductInternalStatus
Syntax: {%ecommercecontext.currentproductinternalstatus%}
ECommerceContext.CurrentProductPublicStatus
Syntax: {%ecommercecontext.currentproductpublicstatus%}
ECommerceContext.CurrentProductSupplier
Syntax: {%ecommercecontext.currentproductsupplier%}
ECommerceContext.CurrentShoppingCart
Syntax: {%ecommercecontext.currentshoppingcart%}
ForumContext.CurrentForum
Syntax: {%forumcontext.currentforum%}
ForumContext.CurrentGroup
Syntax: {%forumcontext.currentgroup%}
ForumContext.CurrentPost
Syntax: {%forumcontext.currentpost%}
ForumContext.CurrentThread
Syntax: {%forumcontext.currentthread%}
MediaLibraryContext.CurrentMediaFile
Syntax: {%medialibrarycontext.currentmediafile%}
MediaLibraryContext.CurrentMediaLibrary
Syntax: {%medialibrarycontext.currentmedialibrary%}
PortalContext.ViewMode
Syntax: {%portalcontext.viewmode%}
SiteContext.CurrentUser
Syntax: {%sitecontext.currentuser%}

Macro operations

add
Syntax: |(add)<number>
Returns: Adds the value
append
Syntax: |(append)<string>
Returns: Appends (suffixes) the given string to the value
Example: {%Zero|(append)ABC%} returns 0ABC
clear
Syntax: |(clear)
Returns: Clears current value to produce empty result
contains
Syntax: |(contains)<string>
Returns: True if value contains given string
cos
Syntax: |(cos)
Returns: Cosine
Example: {%Something|(cos)%}
culture
Syntax: |(culture)<code>
Returns: Returns the value in specified culture
Example: {%SKUPrice|(culture)en-us%} writes the product price in an English culture formatting
default
Syntax: |(default)<value>
Returns: Default value (if value is not found)
Example: {%SKUPrice|N/A%} writes product price or N/A if the document is not a product
divide
Syntax: |(divide)<value>
Returns: Divides the value by the given number
Example: {%Something|(divide)3%}
encode
Syntax: |(encode)<true/false>
Returns: HTMLHelper.HTMLEncode
Example: {%DocumentName|(encode)true%} or {%DocumentName|(encode)%} writes the HTML encoded document name, such as Black & white
endswith
Syntax: |(endswith)<string>
Returns: True if value ends with given string
equals
Syntax: (equals)<value>
Returns: Returns “true” if the resolved value matches the given value, else returns “false”. Uses the (truevalue), (falsevalue) settings for the output.
Example: {%UserName|(equals)administrator%} writes true if the user is administrator
escape
Syntax: (operation)\|(operation)
Returns: Escapes the macro
Example: {%CurrentUserName|(append)\|(you)%}
falsevalue
Syntax: |(falsevalue)<value>
Returns: Output settings for the negative output of the comparisson
Example: {%UserName|(equals)administrator|(truevalue)Yes|(falsevalue)No%} writes No if the user is not administrator
format
Syntax: |(format)<format>
Returns: Formatted value
Example: {%SKUPrice|(format){0:f1}%} writes the product price with precision for one decimal place
getmatch
Syntax: |(getmatch)<regex>
Returns: Regex.Match
Example: {%CurrentDocument.DocumentName|(getmatch)[k-r]%} will result in "om" on "Home"
greaterthan
Syntax: |(greaterthan)<number>
Returns: True if current value is greater than given number
handlesqlinjection
Syntax: |(handlesqlinjection)
Returns: Resolver will handle the SQL injection of the result
jsescape
Syntax: |(jsescape)
Returns: Replaces quotes and \n (javascript escapes)
limitlength
Syntax: |(limitlength)<chars>
Returns: TextHelper.LimitLength
lowerthan
Syntax: |(lowerthan)<number>
Returns: True if current value is lower than given number
mappath
Syntax: |(mappath)
Returns: Maps the virtual path to the physical path
Example: Maps ~/Home.aspx to C:\Inetpub\wwwroot\KenticoCMS\Home.aspx
matches
Syntax: |(matches)<regex>
Returns: True if regular expression matched on the given value
multiply
Syntax: |(multiply)<number>
Returns: Multiplies the value
not
Syntax: |(not)
Returns: Negates current value
notequals
Syntax: |(notequals)<value>
Returns: Returns “false” if the resolved value matches the given value, else returns “true”. Uses the (truevalue), (falsevalue) settings for the output.
Example: {%UserName|(notequals)administrator%} – Writes false if the user is administrator
notrecursive
Syntax: |(notrecursive)
Returns: Explicitly disables the recursion of the macros
padleft
Syntax: |(padleft)<total width>, |(padleft)<total width>(with)<char>
Returns: Makes sure that the string has total width of characters, filling the blanks with space
Example: {%Zero|(add)5|(padleft)3(with)0%} returns 005
padright
Syntax: |(padright)<total width>, |(padright)<total width>(with)<char>
Returns: Makes sure that the string has total width of characters, filling the blanks with space
pow
Syntax: |(pow)<value>
Returns: Raises the first argument to the power of the second argument
Example: {%Something|(pow)2%}
prepend
Syntax: |(prepend)<string>
Returns: Prepends (prefixes) the given string to the value
Example: {%Zero|(prepend)ABC%} returns ABC0
regexreplace
Syntax: |(regexreplace)<regex>(with)<dest>
Returns: Replaces the source string with the destination string using regular expressions
replace
Syntax: |(replace)<src>(with)<dest>
Returns: Replaces the source string with the destination string
Example: {%CurrentDocument.DocumentName|(replace)e(with)er%} on "Home" will result in "Homer"
resolve
Syntax: |(resolve)
Returns: Resolves macros
resolvebbcode
Syntax: (resolvebbcode)<true/false>
Returns: Resolves the BB code in the result of the macro
Example: {%MessageText|(resolvebbcode)true%} or {%MessageText|(resolvebbcode)%} writes the resolved BB code such as conversion of [url]… to <a href="…
resolveurl
Syntax: |(resolveurl)
Returns: Resolves the virtual path or URL
Example: Converts ~/Home.aspx to /KenticoCMS/Home.aspx
saveas
Syntax: |(saveas)<key>
Returns: Saves current value to the selector (under current resolving context)
sin
Syntax: |(sin)
Returns: Sine
Example: {%Something|(sin)%}
sqlescape
Syntax: |(sqlescape)
Returns: Replaces ' with '' (SQL escapes)
sqrt
Syntax: |(sqrt)
Returns: Square root
Example: {%Something|(sqrt)%}
startswith
Syntax: |(startswith)<string>
Returns: True if value starts with given string
striptags
Syntax: |(striptags)
Returns: HTMLHelper.StripTags
substring
Syntax: |(substring)<start>, |(substring)<start>;<length>
Returns: The part of the string after the given index
Example: {%CurrentDocument.DocumentName|(substring)1;3%} on document "News" will give you "ews"
tan
Syntax: |(tan)
Returns: Tangent
Example: {%Something|(tan)%}
tobool
Syntax: (tobool)<default value>
Returns: Conversion to Boolean, uses the (truevalue), (falsevalue) settings as a result
Example: {?onlyvalid|(tobool)true?} writes false if onlyvalid querystring parameter is false, else returns true
todatetime
Syntax: (todatetime)<default value>
Returns: Conversion to DateTime, uses the (culture) settings
Example: {?targettime|(todatetime)?} converts the targettime query parameter to date time or DateTime.MinValue
todouble
Syntax: (todouble)<default value>
Returns: Conversion to Double (uses the culture settings)
Example: {?price|(todouble)10.2?} converts the price query parameter to double or 10.2
toguid
Syntax: (toguid)<default value>
Returns: Conversion to GUID
Example: {?userguid|(toguid)?} converts the userguid query parameter to Guid or Guid.Empty
toint
Syntax: (toint)<default value>
Returns: Converts the result to integer, if not successful, uses the default value.
Example: {?tagid|(toint)0?} writes the valid tagid from querystring or 0 if not valid
tolower
Syntax: |(tolower)<true>
Returns: Converts the result to lowercase
Example: {%DocumentName|(tolower)true%} or {%DocumentName|(tolower)%} writes black & white
toupper
Syntax: |(toupper)<true>
Returns: Converts the result to uppercase
Example: {%DocumentName|(toupper)true%} or {%DocumentName|(toupper)%} writes BLACK & WHITE
trim
Syntax: |(trim), |(trim)<chars>
Returns: Removes the white spaces on the beginning and end of the value
Example: {%EmptyString|(append)ABCD|(trim)AD%} returns BC
trimend
Syntax: |(trimend), |(trimend)<chars>
Returns: Does the trimming only on the end of the string
trimstart
Syntax: |(trimstart), |(trimstart)<chars>
Returns: Does the trimming only on the end of the string
truevalue
Syntax: |(truevalue)<value>
Returns: Output settings for the positive output of the comparisson
Example: {%UserName|(equals)administrator|(truevalue)Yes|(falsevalue)No%} writes Yes if the user is administrator
unresolveurl
Syntax: |(unresolveurl)
Returns: Unresolves the URL
urlencode
Syntax: |(urlencode)<true/false>
Returns: HttpUtility.UrlEncode
Example: {%DocumentName|(urlencode)true%} or {%DocumentName|(urlencode)%} writes the URL encoded document name, such as All%20items

Complex macros

Nested
Syntax: {%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns: Nested macro
Example: {%DocumentName|(equals)Home|(truevalue){(1)%param%(1)}%}
Nested #2
Syntax: {%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns: Nested macro
Example: {%DocumentMenuCaption|(equals)|(truevalue){(1)%DocumentName%(1)}|(falsevalue){(2)%DocumentMenuCaption%(2)}%}
Nested #3
Syntax: {%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns: Nested macro
Example: {(1)%DocumentMenuCaption|(equals)|(truevalue){(2)%DocumentName%(2)}|(falsevalue){(3)%DocumentMenuCaption%(3)}%(1)}
Web part container title (nested)
Syntax: {%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns: Nested macro
Example: {(1)%ContainerTitle|(equals)|(truevalue)|(falsevalue)<h2>{(2)%ContainerTitle%(2)}</h2>%(1)}

giovedì 7 aprile 2016

Gzip delle risorse


Per attivare la compressione delle risorse HTML è necessario inserire la seguente chiave nel web.config
<add key="CMSAllowGZip" value="true" />

Utilizzare gli URL extension-less ed estensioni particolari

Quando si crea un nuovo sito in Kentico questo viene impostato per default con gli URL delle pagine che utilizzano l'estensione .aspx. E' possibile impostare il sito web per utilizzare URL senza estensione tramite la chiave nel web.config:
<add key= "CMSUseTrailingSlashOnlyForExtensionLess" value="true" />

Deve essere anche impostato correttamente IIS.

Attenzione: non è possibile utilizzare una configurazione mista. Gli URL devono essere tutti con o senza estensione.

Fonte:
https://docs.kentico.com/display/K8/Custom+and+extensionless+URLs

Abilitare un carattere speciale come valido per gli URL


Per ragioni di sicurezza e compatibilità alcuni caratteri non possono essere utlizzati per comporre gli URL. A volte però, specialmente nei vecchi siti asp erano utilizzati ed in caso di migrazione è necessario inserirli tra quelli consentiti. Ad esempio per poter effettuare dei redirect 301.

Per attivare questa configurazione è necessario inserire la seguente chiave nel web.config:

<add key="CMSForbiddenURLValues" value="$%:?&quot;&lt;>|&amp;'#[]=" />

Indicando quali sono i caratteri esclusi. E' anche necessario replicare la stessa configurazione sul server web IIS.

Inserire il tag per indicare il canonical URL

In caso di una pagina con dei parametri in GET e/o con tanti alias c'è la possibilità che i motori di ricerca non capiscano che si tratta sempre della stessa url. Questo comporta la generazione di duplicati nell'indice dei motori di ricerca con conseguente penalizzazione del sito. Per ovviare è possibile indicare con il tag canonical URL qual'è l'unico URL originale della pagina.

Ecco una macro che stampa il canonical URL:

{%//canonical url
  straspx="";
  foreach (alias in CurrentSite.SiteDomainAliases) {
    if (alias.SiteDefaultVisitorCulture == CMSContext.CurrentDocumentCulture) {
      if(CurrentDocument.CultureVersions[alias.SiteDefaultVisitorCulture].DocumentUrlPath==""){
        straspx="";
      } else{
        straspx=".aspx";
      }
      println("<link rel=\"canonical\" href=\"https://" + alias.DisplayName + CurrentDocument.CultureVersions[alias.SiteDefaultVisitorCulture].DocumentUrlPath + straspx + "\"/>")
    }
  }
#%}

Questa macro tiene conto dei siti multilingua e degli alias.

Il codice HTML risultante:

<link rel="canonical" href="https://www.sitoesempio.com/contenuto.aspx"/>

Macro per inserire il tag di tipo "hreflang" nei siti multilingua

Quando si ha un sito web multilingua può essere utile inserire nelle pagine il tag hreflang.
Questo aiuta a far capire ai motori di ricerca che le pagine dello stesso contenuto ma tradotte si riferiscono allo stesso argomento e che sono una la traduzione dell'altra.

Ecco la macro da posizionare nella header:

{%
  straspx="";
  strwww="https://";

  foreach (page in CurrentDocument.CultureVersions) {
    foreach (alias in CurrentSite.SiteDomainAliases) {
        if (alias.SiteDefaultVisitorCulture == page.DocumentCulture) {
            if(page.DocumentUrlPath=""){
              straspx="";
            } else{
              straspx=".aspx";
            }
            println("<link rel=\"alternate\" href=\""+ strwww + alias.DisplayName + page.DocumentUrlPath + straspx + "\" hreflang=\""+ page.DocumentCulture.Substring(0,2) +"\" />".Trim())
        }      
    }
  }
#%}

La macro stamperà un codice HTML come questo:

<link rel="alternate" href="https://www.sitoesempio.com/contenuto-en.aspx" hreflang="en" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-fr.aspx" hreflang="fr" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-hu.aspx" hreflang="hu" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-pl.aspx" hreflang="pl" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-es.aspx" hreflang="es" />


Se invece si vuole usare la codifica completa del codice ISO lingua+nazione è necessario quest'altro codice. Questo codice forza anche una falsa corrispondenza tra dominio .mx e lingua es-es impostando es-mx.

{%
  straspx="";
  strwww="https://";

  foreach (page in CurrentDocument.CultureVersions) {
    foreach (alias in CurrentSite.SiteDomainAliases) {
        if (alias.SiteDefaultVisitorCulture == page.DocumentCulture) {
            if(page.DocumentUrlPath=""){
              straspx="";
            } else{
              straspx=".aspx";
            }
            if (alias.DisplayName.Contains(".mx")) {
            println("<link rel=\"alternate\" href=\""+ strwww + alias.DisplayName + page.DocumentUrlPath + straspx + "\" hreflang=\"es-MX\" />".Trim())
            } else  {
            println("<link rel=\"alternate\" href=\""+ strwww + alias.DisplayName + page.DocumentUrlPath + straspx + "\" hreflang=\""+ page.DocumentCulture +"\" />".Trim())
            }
        }     
    }
  }
#%}


Il risultato sarà:
 <link rel="alternate" href="https://www.sitoesempio.com/contenuto-en.aspx" hreflang="en-US" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-fr.aspx" hreflang="fr-FR" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-es.aspx" hreflang="es-ES" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-mx.aspx" hreflang="es-MX" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-hu.aspx" hreflang="hu-HU" />
<link rel="alternate" href="https://www.sitoesempio.com/contenuto-pl.aspx" hreflang="pl-PL" />

Come impostare la windows autentication su un website Kentico

Se si vuole proteggere un sito web Kentico con un set di credenziali si può utilizzare la basic autenthication di Windows. Così facendo si può usufruire facilmente dell'integrazione con Active Directory.

Ma attenzione, non è sufficiente configurare correttamente IIS per gestire questa autenticazione. Se non si seguono tutti i passaggi della guida la pagina successiva alla login sarà la pagina di login di backend e non la home del sito web.

E' anche possibile scegliere se proteggere l'intero sito o solo una cartella.

Fonte:
https://docs.kentico.com/display/K8/Securing+a+website+section+using+Windows+authentication


domenica 6 marzo 2016

Content Staging - Aggiornare l'ordine degli elementi in una zona dell'albero documenti

Se usate il content staging in maniera assidua avrete notato che a volte non viene rispettato l'ordine dei documenti nel passaggio dei task. Questo comporta un disallineamento tra l'ordinamento dei nodi del primo ambiente rispetto al secondo. L'effetto è accentuato nel caso vi siano anche delle creazioni di nuovi documenti. Questa situazione potrebbe portare ad una visualizzazione diversa dei nodi sul front-end.

Per forzare l'ordinamento dei documenti è sufficiente muovere un solo documento all'interno dello stesso ramo dell'albero e poi muoverlo nuovamente nella sua posizione originaria. Così facendo non sarà cambiato nulla, ma si generano un numero di task di aggiornamento pari al numero dei documenti di quella parte di albero. Questi task, una volta portati con il content staging nel server target, andranno a riportare l'esatto ordinamento dei documenti come sul server source.

Kentico 8 - Utilizzare la barra di CKEditor in versione Full

Se la barra di CKEditor che viene fornita di default vi sta stretta è possibile far apparire quella standard che era presente in Kentico 7. Non è una opzione di personalizzazione (inutile che cercate) ma vi serve una chiave del web.config.

<add key="CKEditor:DefaultToolbarSet" value="Full"/>

Questa chiave è valida dalla 8.1.2 in poi.

Fonte