Back

Blog Detail Page with URL mapping, inline editing, captcha, commenting, and RSS

Description

Blog Detail Page with URL mapping, inline editing, captcha validation, moderated commenting, and an RSS feed (RSS page code included in another code example)

Link: http://www.google.com

Code

${esc.hash}if(${esc.dollar}URLMapContent.inode)
  <div class="news-header">
    <h2>
      ${esc.hash}dotedit(${esc.dollar}!URLMapContent.inode,${esc.dollar}!URLMapContent.title)
      ${esc.hash}editContentlet(${esc.dollar}URLMapContent.inode)
    </h2>
    <span class="byline">${esc.dollar}!URLMapContent.author</span>
    <time datetime="${esc.dollar}date.format('yyyy-MM-dd',${esc.dollar}!URLMapContent.sysPublishDate)T${esc.dollar}date.format('hh:mm:ss',${esc.dollar}!URLMapContent.sysPublishDate)">${esc.dollar}date.format('MMM dd yyyy',${esc.dollar}!URLMapContent.sysPublishDate) at ${esc.dollar}date.format('HH:mm z',${esc.dollar}!URLMapContent.sysPublishDate)</time>
    <div class="addThisNews">${esc.hash}dotParse('/vtl/includes/add-this.vtl')</div>
    <div class="clear"></div>
  </div>
  
  <div class="news-body">
    ${esc.hash}dotedit(${esc.dollar}!URLMapContent.inode,${esc.dollar}!URLMapContent.body)
    <div class="tags">
      <b>Tags:</b>
      ${esc.hash}set(${esc.dollar}tags = ${esc.dollar}!URLMapContent.tags.split(","))
      ${esc.hash}foreach(${esc.dollar}tag in ${esc.dollar}tags)
        <a href="/blogs/?tag=${esc.dollar}{UtilMethods.encodeURL(${esc.dollar}tag.trim())}">${esc.dollar}tag</a>
      ${esc.hash}end
    </div>
  </div>
  <div class="addThisNews">${esc.hash}dotParse('/vtl/includes/add-this.vtl')</div>
  <div class="clear p3">&nbsp;</div>
  <div class="border-bot wrapper p3"><a class="top" href="${esc.hash}">top</a></div>
  
  <div class="comments">
    <!-- Uncomment desired settings -->
    ${esc.hash}${esc.hash}set(${esc.dollar}commentsModeration="News Publisher")
    ${esc.hash}${esc.hash}set(${esc.dollar}commentForceLogin = 'true')
    ${esc.hash}${esc.hash}set(${esc.dollar}commentDateDescending = true)
    ${esc.hash}${esc.hash}set(${esc.dollar}copmmentStripHTML = 'true')
    
    
    ${esc.hash}set(${esc.dollar}myContent = ${esc.dollar}URLMapContent.inode)
    ${esc.hash}set(${esc.dollar}commentTitle = 'Comments')
    ${esc.hash}set(${esc.dollar}commentUseCaptcha = 'true')
    ${esc.hash}set(${esc.dollar}commentAutoPublish = 'true')
    ${esc.hash}set(${esc.dollar}maxDepth = 2)
    ${esc.hash}set(${esc.dollar}commentSourceCode = '/vtl/macros/comments.vtl')
    ${esc.hash}comment(${esc.dollar}myContent)

  </div>
  <div class="clear p3"></div>
  <div class="border-bot wrapper p3"><a class="top" href="${esc.hash}">top</a></div>

${esc.hash}else
  <h3>We are sorry, but the blog you are looking for is no longer available. <a href="/blogs/">Click here to see recent blogs</a>.</h3>
${esc.hash}end

Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor