Cannot login after deploying a theme

Issue

  • We get a white screen and a freemarker exception error when trying to login after deploying an OOTB theme with no customizations created via the theme generator:
    2023-05-26 13:32:51.826 ERROR [http-nio-8080-exec-5][runtime:59] Error executing FreeMarker template
    freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
    ==> sign_in_url  [in template "my-liferay-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 40, column 89]
    ----
    Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
    ----
    ----
    FTL stack trace ("~" means nesting-related):
    	- Failed at: ${sign_in_url}  [in template "my-liferay-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 40, column 87]
    ----
    	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) ~[bundleFile:?]
    	at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:479) ~[bundleFile:?]
    	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401) ~[bundleFile:?]
    	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370) ~[bundleFile:?]
    	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100) ~[bundleFile:?]
    	at freemarker.core.DollarVariable.accept(DollarVariable.java:63) ~[bundleFile:?]
    	at freemarker.core.Environment.visit(Environment.java:331) ~[bundleFile:?]
    	at freemarker.core.Environment.visit(Environment.java:337) ~[bundleFile:?]
    	at freemarker.core.Environment.visit(Environment.java:337) ~[bundleFile:?]
    	at freemarker.core.Environment.process(Environment.java:310) ~[bundleFile:?]
    	at freemarker.template.Template.process(Template.java:383) ~[bundleFile:?]

Environment

  • DXP 7.4

Resolution

  • To resolve the issue follow these steps to create the theme:
    1. Run "yo liferay-theme"
    2. Navigate to the new theme
    3. Update the following devDependencies in package.json:
      1. "liferay-frontend-theme-styled": "6.0.63",
      2. "liferay-frontend-theme-unstyled": "6.0.52",
    4. Run "yarn" to install/update dependencies
    5. Run "yarn build" to build the theme
    6. Run "gulp deploy" to deploy the theme
    7.  Check portal normal.ftl in the build folder to confirm that line 40 includes "<#if !is_signed_in && show_sign_in>"

Additional Information

这篇文章有帮助吗?
2 人中有 2 人觉得有帮助