Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-753

redirect.ftl throws a FreeMarker template error when target page cannot be found

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.4.5
    • 1.4.2
    • templates
    • None
    • Java 6, Mac OS X 10.6, Safari
    • Yes

      When you rename a page which is the target of a redirect you will get a FreeMarker template error (at least in edit mode).

      This template fixes the problem:

      [#assign cms=JspTaglibs["cms-taglib"]]
      [@cms.mainBar dialog="stkRedirect" /]
      <p style="margin-top:40px">
      [#if mgnl.editMode && content.path?has_content]
        [#assign targetContent = mgnl.getContent(content.path)!]
        [#if targetContent?has_content]
          [#assign path="${mgnl.createLink(targetContent)!''}"]
          This page will redirect to <a href="${path}">${path}</a>
        [#else]
          The target page (${content.path!}) could not be found. Please fix the redirect.
        [/#if]
      [#else]
        Please define a path where to redirect the request.
      [/#if]
      </p>
      

      Even better of course would be a redirect template that would store the UUID of the target page instead of the path!

        Acceptance criteria

              cringele Christian Ringele
              will Will Scheidegger
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 0.5h
                  0.5h
                  Remaining:
                  Remaining Estimate - 0.5h
                  0.5h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified