Yes, you can do it this way:

@Inject
private PageRenderLinkTransformer linkTransformer;

@Inject
private RequestGlobals requestGlobals;

PageRenderRequestParameters requestParameters =
linkTransformer.decodePageRenderRequest(requestGlobals.getRequest());





On Wed, Nov 18, 2020 at 6:09 PM Numa Schmeder <n...@dfacto.ch> wrote:

> Hello,
>
> Just wondering if you have a way to access the PageRenderRequestParameters
> inside a component.
>
> I am building a LocalePageLink component for SEO purpose, that translates
> the current page url into its localized version, instead of using a locale
> toggle with an action link.
>
> I need it for SEO friendly language switcher but also for alternate href.
>
> My component is working correctly, and will render
> <a href="#" t:type="LocalePageLink" t:id="localeEN" locale="en"
> page="mypagename”  context=“1"> EN </a>
> will render:  /en/mypagename/1 for locale en
>
> <a href="#" t:type="LocalePageLink" t:id="localeFR" locale=“fr"
> page="mypagename”  context=“1"> EN </a>
> will render:  /en/mypagename/1 for locale fr
>
> But I want my component to be smarter and deduce the page name, context
> and parameters from the current url if they are not specified to the
> component.
> I know how to get the page name using componentResources, but I didn’t
> find a way to get the activation context and the context parameters without
> parsing the url.
>
> On the same subject I would like to have better page name than the “java”
> page name. For example if my page name is BuyTicket.java I would like to
> have
> /en/buy-concert-ticket in english
> /fr/acheter-tickets-concert in french
> … and so on.
>
> So I would like to localize page names in url, and eventually improve the
> name for SEO purpose, do you know where should I hook ?
>
> I would be happy to share my components once they are functional.
>
> Thank you for your help,
>
> Numa
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: dev-h...@tapestry.apache.org
>
>

-- 
Ilya Obshadko

Reply via email to