I am trying to create a robots.txt file in AEM using the two links --
[1] http://www.wemblog.com/2013/06/how-to-implement-robotstxt-sitemapxml.html
[2] https://forums.adobe.com/thread/896654
Following [1]; the text file does not work at all -- we can create a simple nt:file robots.txt file in crx but when we hit the file -
http://localhost:4502/content/mysite/en/robots.txt - the browser downloads the file instead of displaying the content of the text file on the page.
I also enabled txt rendition (Enable Plain Text) in Apache Sling GET Servlet ; but there was the same result.
Following [2] ; when you print a page property in sightly using ${pageProperties.robotsTextContent} ; the property is printed on one line in the .html page -
User-agent: * Disallow: / New text: q Newer Text:s
while it has been entered in separate lines in the text-area. Line separator is important in robots.txt file. We need the property to be outputted in different lines as they have been authored in page properties. I used @context ='text' and @context ='html' in the sightly file but it printed '\n' as it on the page without line separation.
Somehow; the txt rendition is not working; creating a robotstext.txt.html file and hitting the page after enabling the text rendition using Apache Sling GET Servlet outputs as
http://localhost:4502/content/mysite/en/robots.txt
** Resource dumped by PlainTextRendererServlet** Resource path:/content/mysite/en/robots Resource metadata: {sling.modificationTime=-1, sling.characterEncoding=null, sling.parameterMap={}, sling.contentType=null, sling.creationTime=-1, sling.contentLength=-1, sling.resolutionPath=/content/mysite/en/robots, sling.resolutionPathInfo=.txt} Resource type: cq:Page Resource super type: -
** Resource properties ** jcr:primaryType: cq:Page jcr:createdBy: admin jcr:created: java.util.GregorianCalendar[time=1480233560436,areFieldsSet=true,areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT+11:00",offset=39600000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2016,MONTH=10,WEEK_OF_YEAR=49,WEEK_OF_MONTH=5,DAY_OF_MONTH=27,DAY_OF_YEAR=332,DAY_OF_WEEK=1,DAY_OF_WEEK_IN_MONTH=4,AM_PM=1,HOUR=6,HOUR_OF_DAY=18,MINUTE=59,SECOND=20,MILLISECOND=436,ZONE_OFFSET=39600000,DST_OFFSET=0]
When disabling the Apache Sling GET Servlet text rendition; it outputs an error.
Did someone else try putting a robots.txt file in AEM? Why is the OOTB text rendition not working properly in AEM?
Any pointers for either of the two approaches will be highly appreciated.