NilsN
June 4, 2020, 1:57pm
4
You’d have to resolve the correct link for each channel and pass it to the front-end.
Keep in mind that the PageModel for categories and product pages will always be the start page, but you can work around that by for example injecting CategoryModel and ProductModel.
Here are some perhaps helpful threads:
Hi,
I got a website where i want to switch language and it redirects to same page on that language.
We got it setup that each language got a channel:
hostname/sv
hostname/en
So if I am on page: hostname/en/about-us i want to redirect to: hostname/sv/om-oss.
I have done this by using:
requestModel.CurrentPageModel.SystemId
PageService
ChannelService
UrlService
Though when a user is on a category or product page the SystemId above will not point to that “Page”.
I’m thinking i need to get…
I’m using the requestModelAccessor.RequestModel.CurrentPageModel to see which the current page is.
But when i’m on the product or category page it says i am on the StartPage.
How can i see if the current page is the product or category page?
Litium version: 7.3.1
I had that exakt line earlier and it didn’t work when I tried to navigate to a category page. The ParentPageSystemId was still an empty Guid. In the build-method you refer I changed to look at the RawUrl of the request and compare it to the startpageUrl. Got it working for now