Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Brohäll 295 posts 561 karma points c-trib
    Mar 28, 2017 @ 15:28
    Anders Brohäll
    0

    AltTemplate not working

    Hi,

    http://whatever.ext/page?altTemplate=grid, nor http://whatever.ext/page/grid are working on my implementation of 7.5.11.

    <notFound assembly="umbraco" type="SearchForTemplate"/> 
    

    ... is set in the NotFoundHandlers in 404handlers.config ... and i do of course have a template called Grid.

    Do we know why the site doesn't render the template? I can't really find any references to the NotFoundHandlers-section. Should there be one in another config, or is it supposed to be included by magic?

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 28, 2017 @ 15:43
    Dan Diplo
    102

    First, you need to ensure you have added the template via the Umbraco interface, so it exists in the developer tree. It will only render templates added this way.

    You should also check /config/umbracoSettings.config and look at element at the bottom that looks similar to this and check that disableAlternativeTemplates is false

          <web.routing
            trySkipIisCustomErrors="false"
            internalRedirectPreservesTemplate="false"
            disableAlternativeTemplates="false" 
            disableFindContentByIdPath="false"
            umbracoApplicationUrl="">
          </web.routing>
    

    You should also have:

      <notFound assembly="umbraco" type="SearchForAlias" />
      <notFound assembly="umbraco" type="SearchForTemplate" />
    

    in your 404handlers.config

  • Anders Brohäll 295 posts 561 karma points c-trib
    Mar 28, 2017 @ 15:50
    Anders Brohäll
    0

    Excellent, the disableAlternativeTemplates-switch was my solution. For the record and future reference, I assume that you mean that the template should exist in the Settings tree, not Developer?

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 28, 2017 @ 15:59
    Dan Diplo
    0

    Yes, sorry, I meant Settings (though I also think Developer section would be more appropriate, but that's another argument...)

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jun 29, 2017 @ 21:00
    Heather Floyd
    0

    I am having the same issue - but the UmbracoSettings and 404handlers configs both have the proper options...

    This is an Umbraco Cloud v.7.6.3 install.

    I know the template is set up in "Settings" properly - if I add the template as an "allowed" one to the doctype and select it in the drop-down on the content node, it displays just fine.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 29, 2017 @ 21:06
    Dave Woestenborghs
    0

    Hi Heather,

    Anything showing up in the logs when you make a request for the alt template. When the log level is set to DEBUG that should give some useful information.

    Dave

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jun 30, 2017 @ 17:50
    Heather Floyd
    0

    Hi David,

    I don't see anything in the log...

    I have this in web.config:

    <compilation defaultLanguage="c#" debug="true" batch="false"  targetFramework="4.5" numRecompilesBeforeAppRestart="50">
    

    Are you referring to some other setting for DEBUG?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 30, 2017 @ 17:53
    Dave Woestenborghs
    0

    Hi Heather,

    I'm refering to the log4net.config file. There you can change the log level. If you set it to DEBUG ( I think default is INFO) it will log usefull info when you make a request.

    Dave

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jun 30, 2017 @ 18:22
    Heather Floyd
    0

    Thanks, David, found it :-)

    So... the additional results indicate that it recognizes that I am asking for the alttemplate, and it FINDS the template, and SAYS it is running with that template... but the browser does not display the alttemplate...

    2017-06-30 14:02:52,156 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindDomain: Uri="http://mysite.local/?alttemplate=MySpecialTemplate"
    2017-06-30 14:02:52,192 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindDomain: Matches no domain
    2017-06-30 14:02:52,216 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindDomain: Culture="en-US"
    2017-06-30 14:02:52,217 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindPublishedContentAndTemplate: Path="/"
    2017-06-30 14:02:52,219 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindPublishedContent: Begin finders
    2017-06-30 14:02:52,227 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrl - Test route "/"
    2017-06-30 14:02:53,008 [P6912/D3/T57] INFO  ((null):(null)) Umbraco.Core.PluginManager - Resolving umbraco.interfaces.IDiscoverable
    2017-06-30 14:02:53,009 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Core.PluginManager - Resolving umbraco.interfaces.IDiscoverable: found a cached type list.
    2017-06-30 14:02:53,009 [P6912/D3/T57] INFO  ((null):(null)) Umbraco.Core.PluginManager - Resolved umbraco.interfaces.IDiscoverable (took 0ms)
    2017-06-30 14:02:53,009 [P6912/D3/T57] INFO  ((null):(null)) Umbraco.Core.PluginManager - Resolving Umbraco.Core.PropertyEditors.IParameterEditor
    2017-06-30 14:02:53,010 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Core.PluginManager - Resolving Umbraco.Core.PropertyEditors.IParameterEditor: loaded types from cache file.
    2017-06-30 14:02:53,011 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Core.PluginManager - Resolved Umbraco.Core.PropertyEditors.IParameterEditor, caching (true).
    2017-06-30 14:02:53,011 [P6912/D3/T57] INFO  ((null):(null)) Umbraco.Core.PluginManager - Resolved Umbraco.Core.PropertyEditors.IParameterEditor (took 1ms)
    2017-06-30 14:02:53,415 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrl - Got content, id=1168
    2017-06-30 14:02:53,416 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindPublishedContent: End finders, no document was found (took 1197ms)
    2017-06-30 14:02:53,420 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandlePublishedContent: Begin
    2017-06-30 14:02:53,446 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FollowInternalRedirects: Failed to redirect, value of 'umbracoInternalRedirectId' is not an int nor a GuidUdi
    2017-06-30 14:02:53,446 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FollowInternalRedirects: Failed to redirect, value of 'umbracoInternalRedirectId' does not lead to a published document
    2017-06-30 14:02:53,479 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - EnsurePublishedContentAccess: Page is not protected
    2017-06-30 14:02:53,480 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandlePublishedContent: End
    2017-06-30 14:02:53,488 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindTemplate: Look for alternate template alias="MySpecialTemplate"
    2017-06-30 14:02:53,495 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindTemplate: Got template id=1450 alias="MySpecialTemplate"
    2017-06-30 14:02:53,496 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindTemplate: Running with template id=1450 alias="MySpecialTemplate"
    2017-06-30 14:02:53,566 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandleWildcardDomains: Path="-1,1168"
    2017-06-30 14:02:53,568 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandleWildcardDomains: No match.
    2017-06-30 14:02:53,586 [P6912/D3/T57] DEBUG ((null):(null)) Umbraco.Web.UmbracoModule - Response status: Redirect=none, Is404=false, StatusCode=0
    

    If I use the "routing" version (removing "?alttemplate=") I get the same browser result, and this is log... which seems to indicate that the template was found:

    2017-06-30 14:16:31,779 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.UmbracoModule - Begin request: http://mysite.local/MySpecialTemplate.
    2017-06-30 14:16:31,783 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Core.Sync.DatabaseServerMessenger - Syncing from database...
    2017-06-30 14:16:31,795 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Core.Sync.DatabaseServerMessenger - Complete (took 11ms)
    2017-06-30 14:16:31,795 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindDomain: Uri="http://mysite.local/myspecialtemplate"
    2017-06-30 14:16:31,796 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindDomain: Matches no domain
    2017-06-30 14:16:31,796 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindDomain: Culture="en-US"
    2017-06-30 14:16:31,796 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindPublishedContentAndTemplate: Path="/myspecialtemplate"
    2017-06-30 14:16:31,796 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindPublishedContent: Begin finders
    2017-06-30 14:16:31,797 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrl - Test route "/myspecialtemplate"
    2017-06-30 14:16:31,797 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrl - No match.
    2017-06-30 14:16:31,797 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByIdPath - Not a node id
    2017-06-30 14:16:31,812 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByRedirectUrl - No match for route: "/myspecialtemplate".
    2017-06-30 14:16:31,812 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Running for legacy url='myspecialtemplate'.
    2017-06-30 14:16:31,813 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Handler 'umbraco.SearchForAlias'.
    2017-06-30 14:16:31,813 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Replace handler 'umbraco.SearchForAlias' by new finder 'Umbraco.Web.Routing.ContentFinderByUrlAlias'.
    2017-06-30 14:16:31,815 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Handler 'umbraco.SearchForTemplate'.
    2017-06-30 14:16:31,815 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Replace handler 'umbraco.SearchForTemplate' by new finder 'Umbraco.Web.Routing.ContentFinderByNiceUrlAndTemplate'.
    2017-06-30 14:16:31,816 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrlAndTemplate - Valid template: "myspecialtemplate"
    2017-06-30 14:16:31,816 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrl - Test route "/"
    2017-06-30 14:16:31,817 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNiceUrl - Got content, id=1168
    2017-06-30 14:16:31,818 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Finder 'Umbraco.Web.Routing.ContentFinderByNiceUrlAndTemplate' found node with id=1168.
    2017-06-30 14:16:31,818 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.ContentFinderByNotFoundHandlers - Handler 'umbraco.SearchForTemplate' found valid node with id=1168.
    2017-06-30 14:16:31,818 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FindPublishedContent: End finders, no document was found (took 21ms)
    2017-06-30 14:16:31,818 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandlePublishedContent: Begin
    2017-06-30 14:16:31,819 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FollowInternalRedirects: Failed to redirect, value of 'umbracoInternalRedirectId' is not an int nor a GuidUdi
    2017-06-30 14:16:31,819 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - FollowInternalRedirects: Failed to redirect, value of 'umbracoInternalRedirectId' does not lead to a published document
    2017-06-30 14:16:31,819 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - EnsurePublishedContentAccess: Page is not protected
    2017-06-30 14:16:31,819 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandlePublishedContent: End
    2017-06-30 14:16:31,819 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequest - FindTemplate: Has a template already, and no alternate template.
    2017-06-30 14:16:31,820 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandleWildcardDomains: Path="-1,1168"
    2017-06-30 14:16:31,820 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.Routing.PublishedContentRequestEngine - HandleWildcardDomains: No match.
    2017-06-30 14:16:31,820 [P6912/D3/T100] DEBUG ((null):(null)) Umbraco.Web.UmbracoModule - Response status: Redirect=none, Is404=false, StatusCode=0
    

    So... not sure where to go from here, other than just assume I won't be able to use this feature in this site at least.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 30, 2017 @ 18:26
    Dave Woestenborghs
    0

    Hi Heather,

    Looking at the log I think you are using a internal redirect ?

    Maybe you can check this setting in the umbracoSettings.config

    https://our.umbraco.org/documentation/Reference/Config/umbracoSettings/#web-routing

    See if alt template are not disabled and that it preserves the template.

    Dave

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jun 30, 2017 @ 18:38
    Heather Floyd
    0

    Well, the content node doctype has the property to allow an internal redirect to be selected, but this particular node doe not have one assigned.

    The web routing was set to :

      <web.routing trySkipIisCustomErrors="true" internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false" umbracoApplicationUrl=""></web.routing>
    

    so I updated to internalRedirectPreservesTemplate="true" :

      <web.routing trySkipIisCustomErrors="true" internalRedirectPreservesTemplate="true" disableAlternativeTemplates="false" disableFindContentByIdPath="false" umbracoApplicationUrl=""></web.routing>
    

    But the result in the browser is the same and the log appears the same as well.

Please Sign in or register to post replies

Write your reply to:

Draft