Closed leahjennings closed 2 months ago
@leahjennings Hi Leah, context parameters can be a little tricky. When setting up a Context Parameter, you'll need to enter the content (Edit HTML) for each unique parameter. The content entered is not shared across parameters. By entering content for each parameter, you also gain the ability to use Display from dates, versioning and approval for the content.
We've also reviewed the documentation and will take this opportunity to polish it further.
Let me know if you have any questions.
@leahjennings Hi Leah - I will be closing this issue at this time. Please reach out if you have any questions.
Description
I have written a couple of pages that will only display content when passed a Guid via a URL context parameter. I've noticed weird behavior that the block seems to have all the code erased, but haven't been able to nail down what is going until today. Apparently if I have a Context Parameter set on the HTML Content block itself, it will erase the HTML. In my tests in production, if it is passed a parameter I have used to test with, sometimes it does load properly. But any new guid for sure erases it.
I just went through the below steps to reproduce and confirmed it is consistently reproducible. Also, I know the code in the block won't really make sense on the demo site, but the blue alert info bar should show up at the least (as seen in the testing steps).
Also, I'm not entirely sure what that parameter is supposed to do. Apparently what I needed to accomplish is possible without setting that parameter.
Actual Behavior
The HTML Content block "loses" its code when a ContextParameter is set on the block.
Expected Behavior
I would expect that the HTML Content block would not lose its code if the ContextParameter setting has a value.
Steps to Reproduce
On the demo site, login, and go to the External site specifically
Click the child page icon in the admin toolbar and create a new child page
Go to the new page
Add an HTML Content block to the webpage
Edit the block settings and set the Entity Type to
Step Type
, and set Versioning to TrueEdit the Page Properties and add a route with page parameter of
{CourseGuid}
and name the Context Parameter the sameAdd the following code to the HTML Content block
{% assign course = courses | Where:'StepTypeGuid',Context.StepType.Guid | First %}
{{ PageParameter.CourseGuid }}
{% if course != null and course != '' %} {{ course.Title | SetPageTitle }}
{% else %}
{% endif %}
SELECT TOP 1 * FROM Block b ORDER BY Id DESC
SELECT * FROM htmlcontent hc WHERE hc.BlockId = #### ORDER BY hc.ModifiedDateTime DESC