Upgrading from DD4T to DXA. our website by default will have extensions ex(http://www.mysite.com/index.html) but By default DXA resolves Component Links in Rich Text field and Component Link fields without Page extension(.html) but in my application we need the extension. Please help me get the Page url with extension.
-
Can you explain why you need the file extension?– Rick PannekoekCommented Jul 9, 2018 at 14:25
-
Our existing website urls ends with extensions, so we need it in the same way while upgrading to DXA2.0. Example I need mysite/index.html in richtext field instead of mysite/index– Balajhi SVCommented Jul 9, 2018 at 22:26
-
So you want to use a hybrid web site/app, where parts are served by DXA and other parts are still "legacy"? Can you elaborate? Please update the question rather than in comments.– Rick PannekoekCommented Jul 10, 2018 at 7:51
2 Answers
In DXA 2.0, using the new R2 Data Model and Model Service, link resolving is done in the Model Service.
The Model Service uses the following class for this purpose: https://github.com/sdl/dxa-web-application-java/blob/master/dxa-framework/dxa-common/src/main/java/com/sdl/webapp/tridion/linking/AbstractLinkResolver.java
Note that removal of file extension is configurable through setting dxa.web.link-resolver.remove-extension
-
Sorry Rick i forgot to mention am using .NET.. If can provide details for .NET that will be more helpful. Commented Jul 10, 2018 at 7:15
-
1The Model Service is a separate subsystem which is implemented in Java only. However, it seems you only have to modify its configuration settings, so you don't need much Java knowledge. Commented Jul 10, 2018 at 7:46
Note: For poor people like me. Setting can be found in "{model-service-path}/config/dxa.properties"
dxa.web.link-resolver.remove-extension=false
-
Good to hear that you managed to figure that out! For clarity: it's not that I knew this, but didn't want to disclose it to "poor people". I just found how it worked in code, but didn't know how that translated exactly to configuration files. Commented Jul 10, 2018 at 15:35
-
Rick i didn't mean it in wrong way.. i noticed some code in the Framework solution(Sdl.Web.Tridion.Linking and Sdl.Web.Common.Constants) where the extensions are being removed. i didnt expect tat in service so i mention the path. May be we need to update tat also. Commented Jul 11, 2018 at 13:10
-
It’s OK. Can you still elaborate on why you need the file extension (see my comment on your Question)? This may help others that have a similar situation and it also help us/me to understand how people are using our system. Commented Jul 11, 2018 at 19:51
-
I have updated in the question.. our existing site has extensions so we are moving with the same approach. Commented Jul 13, 2018 at 1:00