<xt:url>will not return a subdomain for http://subdomain.site.com without a page specified in the url ie: http://subdomain.site.com/index
<!--parser:xtscript-->
# Alt headtags pages data variable
var $alt_headtags_pages = {{:
folder/page|
folder/|
sub.domain.com|
domain.com/sub|
test=1|
:}}
# Variables
var $this_page = <xt:url>
var $entry_offset = 1
# Main loop
@loop
# Find the end of the current entry
var $entry_end = call strpos $haystack=$alt_headtags_pages;$needle=|;$offset=$entry_offset
# No more entries left so use normal headtags
if not $entry_end
# Output the normal headtags and exit
print {{ Normal Headtags }}
goto @end_alt_headtags
endif
# Get the next entry
var $needle = call substr $val=$alt_headtags_pages;$start=$entry_offset;$length=($entry_end-$entry_offset)
var $needle = call trim $val=$needle
# Check if the entry matches the current url
var $alt_headtags = call strpos $haystack=$this_page;$needle=$needle
# Entry matches so use the alternative headtags
if $alt_headtags
# Output the alternative headtags and exit
print {{ Alternative Headtags }}
goto @end_alt_headtags
endif
# No match for this entry in the current url
# so move the offset pointer to the start of the next entry
var $entry_offset = ($entry_end+1)
# Loop back
goto @loop
@end_alt_headtags
<!--/parser:xtscript-->
XtGem manual · all sections