URL Parameters in Community page to Lightning Component [AURA]
By looking at the topic, you might be thinking, there would be some extensive JS coding behind it as we’ll need to pass param from community to aura component.
But, It is actually much easier to pass URL parameters to Lightning components in a community page.
The “trick” is to expose your attributes at design time to the page, so they show up in the Lightning page designer as component properties.
You do that in the design definition (the .design file):
<design:component label="Sample"> <design:attribute name="someParam" label="Make Parameters great again" /> </design:component>
This presumes that you component has a parameter
someParam in its attribute definition (in the .cmp file):
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" controller="someController"> <aura:attribute name="someParam" type="String" /> .... stuff here ... </aura:component>
Let’s presume your url looks like
....?color=blue then you add into the property value of your component, after you dragged it onto the lightning page in community builder:
This will pull the value of the color URL parameter and hand it to the someParam attribute of your component. No JS required.
NOTE: Passing URL parameters using component properties is not officially supported and only works on a full page load (which is slow).
Hope that helps