As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hi,
following this topics:
https://docs.alfresco.com/content-services/latest/tutorial/share/pages/#adding-a-new-surf-page-to-share
and
https://docs.alfresco.com/content-services/latest/tutorial/share/pages/#making-the-new-page-the-default
I would like to change de default landing page after login.
Well, if i tightly follow the topics and start the solution with docker (run.bat build_start), than it works as expected!
While if I create the amps and deploy it to my test environment than, the redirect does not works and, after the login I always see the user dashboard.
May you please help?
Please notice that I can see the package deployed on "Module Deployment" console at ../share/service/modules/deploy.
Thanks a lot.
Kind regards.
I did the following steps.
C:\DATI\Macro\Java\projects-test\eclipse\alfresco>mvn archetype:generate -Dfilter=org.alfresco:
…
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 2
Choose a number: 31: 21
...
[INFO] Using property: version = 1.0-SNAPSHOT
Define value for property 'groupId': it.region
Define value for property 'artifactId': landing-page-and-url-injection
Define value for property 'package' it.region: : it.region
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] Total time: 09:54 min
[INFO] Finished at: 2025-08-06T12:39:26 02:00
C:\DATI\Macro\Java\projects-test\eclipse\alfresco>cd landing-page-and-url-injection
After that the docker solution is available at the following addresses:
http://localhost:8080/alfresco/
http://localhost:8180/share
After that, following these topics:
I have imported the project into the IDE and I have added the following files:
Well, after rebuild the project the solution can be tested and it works on docker!
Now, after the login a user can see the document library of the site if he is a member of one site only, otherwise he will se the page of all the site. Anyway I can't see the dashboard anymore.
If I generate the amps and deploy it on a standalone environment whit apply_amps.sh and after a tomcat restart, the solution doesn't works! The user after the login will always be redirected to dashboard.
Please notice that I can see the amp deployed on Module Deployment:
Thanks.
Hi, I did the following steps.
C:\DATI\Macro\Java\projects-test\eclipse\alfresco>mvn archetype:generate -Dfilter=org.alfresco: … Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 2 … 21: 4.8.0 ... Choose a number: 31: 21 [INFO] Using property: version = 1.0-SNAPSHOT Define value for property 'groupId': it.puglia Define value for property 'artifactId': landing-page-and-url-injection Define value for property 'package' it.puglia: : it.puglia Y: y [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 09:54 min [INFO] Finished at: 2025-08-06T12:39:26 02:00 [INFO] ------------------------------------------------------------------------ C:\DATI\Macro\Java\projects-test\eclipse\alfresco>cd landing-page-and-url-injection run.bat build_start for Windows.
After that a docker environment will be created and available at the following links:
Now we can import the SDK on IDE.
Following these topics:
I have implemented a solution with a landing page different from the default one that is tomcat/webapps/share/site-index.jsp.
Here the details:
/src/main/resources/alfresco/web-extension/site-data/pages/landing-page.xml
<?xml version='1.0' encoding='UTF-8'?> <page> <title>Welcome</title> <title-id>page.siteIndex.title</title-id> <description>Landing page for all users - will forward to user site dashboard</description> <description-id>page.siteIndex.description</description-id> <template-instance>landing-page</template-instance> <authentication>user</authentication> </page>
/src/main/resources/alfresco/web-extension/site-data/template-instances/landing-page.xml
<?xml version='1.0' encoding='UTF-8'?> <template-instance> <template-type>landing-page</template-type> </template-instance>
/src/main/resources/alfresco/web-extension/site-data/template-types/landing-page.xml
<?xml version="1.0" encoding="UTF-8"?> <template-type> <title>Site index landing page template type</title> <description>Site index landing page JSP Template Type</description> <!-- Define the rendering processors for this template type --> <processor mode="view"> <id>jsp</id> <jsp-path>/landing-page.jsp</jsp-path> </processor> </template-type>
/src/main/resources/alfresco/web-extension/site-data/configurations/slingshot.site.configuration.xml
<?xml version="1.0" encoding="UTF-8"?> <configuration> <name>Slingshot Project</name> <description>Slingshot Project</description> <source-id>site</source-id> <properties> <theme>lightTheme</theme> <root-page>landing-page</root-page> </properties> </configuration>
/src/main/webapp/jsp/landing-page.jsp
<%-- Copyright 2005 - 2020 Alfresco Software Limited. This file is part of the Alfresco software. If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. Otherwise, the software is provided under the following open source license terms: Alfresco is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Alfresco is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Alfresco. If not, see <http://www.gnu.org/licenses/>. --%> <%@ page import="org.alfresco.web.site.*" %> <%@ page import="org.springframework.extensions.surf.*" %> <%@ page import="org.springframework.extensions.surf.site.*" %> <%@ page import="org.springframework.extensions.surf.util.*" %> <%@ page import="java.util.*" %> <%@ page import="java.util.regex.*" %> <%@ page import="org.apache.http.client.methods.HttpGet" %> <%@ page import="org.apache.http.impl.client.CloseableHttpClient" %> <%@ page import="org.apache.http.impl.client.HttpClients" %> <%@ page import="org.apache.http.util.EntityUtils" %> <% // retrieve userId and context String userid = (String)session.getAttribute(SlingshotUserFactory.SESSION_ATTRIBUTE_KEY_USER_ID); RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT); // no user dashboard page found! create initial dashboard for this user if (!context.getObjectService().hasPage("user/" + userid + "/dashboard")) { Map<String, String> tokens = new HashMap<String, String>(); tokens.put("userid", userid); FrameworkUtil.getServiceRegistry().getPresetsManager().constructPreset("user-dashboard", tokens); } // API call to retrieve sites String siteApiUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/proxy/alfresco/api/people/" + URLEncoder.encode(userid) + "/sites"; String siteApiUrlResponse = ""; try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet requestSites = new HttpGet(siteApiUrl); String jsessionid = session.getId(); requestSites.setHeader("Cookie", "JSESSIONID=" + jsessionid); siteApiUrlResponse = EntityUtils.toString(httpClient.execute(requestSites).getEntity()); System.out.println("Response JSON: " + siteApiUrlResponse); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); } Pattern pattern = Pattern.compile("\\\"shortName\\\"[ ]*:[ ]*\\\"([a-zA-Z0-9_-]+)\\\""); Matcher matcher = pattern.matcher(siteApiUrlResponse); List<String> sites = new ArrayList<>(); while (matcher.find()) { sites.add(matcher.group(1)); } System.out.println("Site available for user: " + sites); // if size sites == 1 redirect to documentlibrary if (sites.size() == 1) { String siteName = sites.get(0); String target = request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName) + "/documentlibrary"; response.sendRedirect(target); } else { // if size sites > 1 redirect to user-sites String target = request.getContextPath() + "/page/user/user-sites"; response.sendRedirect(target); } %>
Rebuild the package and test the solution.
C:\DATI\Macro\Java\projects-test\eclipse\alfresco\landing-page-and-url-injection>run.bat build_start
Please notice that the landing-page.jsp deploy is done manually in tomcat/webapps/share.
Testing the solution, after the login the user will be redirected to the document library of the site where he is a member.
If the user is a member of more than one site than he will be redirected to the the page of all sites.
The dashboard will not be anymore the redirect page after login.
Up to now anything works on docker.
If I build the packages repo and share and deploy the amps on a standalone environment using the apply_amps.sh and after a tomcat restart the package will be available in the Module Deployment page:
But if I try the login I will be always redirect to the dashboard. So, the redirect to landing-page.jsp does not work.
In few words the solution works on docker but doesn't works on standalone env.
Hello, you answer has been marked as spam, I approved it.Could you please edit it and add all the code parts into code blocks, in order to make it clear and more readable?
Done.
thansk to you 🙂you took the time to write the answer to your question after figuring out and to come back to improve the answer. this looks great now.
Yes but it is not a solution but only the details about my first question.
I hope that someone helps.
Thanks again.
Hello,
Maybe you have a conflict with another module deployed in the standalone env (I could see that you have deployed share site creators).
¿Have you tried to deploy in the extension project docker all the customizations instaled on the dev enviroment?
This is the best way to test compatibility before the final deployment.
Best Regards
My way to do this is to create a new sitepreset and set a full dashboard xml preset fot that new site preset for example "sitepippo" under the file in the path "web-extension/site-data/presets/sitepippo-presets.xml"
<?xml version='1.0' encoding='UTF-8'?> <presets> <preset id="sitepippo"> <components> <component> <scope>page</scope> <region-id>title</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/title/collaboration-title</url> </component> <component> <scope>page</scope> <region-id>navigation</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/navigation/collaboration-navigation</url> </component> <component> <scope>page</scope> <region-id>component-2-1</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/site-search</url> <properties> <height>58</height> </properties> </component> <component> <scope>page</scope> <region-id>component-1-1</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/xxx/xxx</url> </component> <component> <scope>page</scope> <region-id>component-1-2</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/yyy/components/dashlet/yyy</url> </component> <component> <scope>page</scope> <region-id>component-1-3</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/colleagues</url> <properties> <height>126</height> </properties> </component> <component> <scope>page</scope> <region-id>component-2-2</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/zzz/documents-scadenze</url> <properties> <height>78</height> </properties> </component> <component> <scope>page</scope> <region-id>component-2-3</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/activityfeed</url> <properties> <height>147</height> </properties> </component> <component> <scope>page</scope> <region-id>component-2-4</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/docsummary</url> <properties> <height>82</height> </properties> </component> <component> <scope>page</scope> <region-id>component-3-1</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/xxx/xxx</url> <properties> <height>90</height> </properties> </component> <component> <scope>page</scope> <region-id>component-3-3</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/xxx/xxx</url> <properties> <height>63</height> </properties> </component> <component> <scope>page</scope> <region-id>component-3-4</region-id> <source-id>site/${siteid}/dashboard</source-id> <url>/components/dashlets/calendar</url> <properties> <height>232</height> </properties> </component> </components> <pages> <page id="site/${siteid}/dashboard"> <page-type-id>generic</page-type-id> <title>Pippo Site Dashboard</title> <title-id>page.siteDashboard.title</title-id> <description>Pippo site's dashboard page</description> <description-id>page.siteDashboard.description</description-id> <template-instance>dashboard-3-columns</template-instance> <authentication>user</authentication> <properties> <sitePages>[{"pageId":"dashboard"}, {"pageId":"documentlibrary"}]</sitePages> <dashboardSitePage>true</dashboardSitePage> <!-- <siteLogo>workspace://SpacesStore/1181d7c0-9086-4c5a-ab2f-9c693ed3c59e</siteLogo> --> </properties> </page> </pages> </preset> </presets>
It does not works. I've also used the ftl insted of jsp like explained here: https://docs.alfresco.com/content-services/latest/tutorial/share/pages/#making-the-new-page-the-default and here: https://connect.hyland.com/t5/alfresco-blog/advanced-share-customization-part-1/ba-p/119497#comments but nothing. Always the some thing: the solution works on docker but doesn't works on standalone env.