Rock U - Content Management - Advanced HTML Block
Transcribed Video Content
We've created the HTML block so that it's simple and accessible, anyone can use it, but also so that it can be extended and used in really clever ways. So let's look at some special settings and other things you can do to use the HTML block in an advanced way. So let's look at some of the more advanced features that HTML blocks offer. So we're gonna go to the settings, which you can access by going to the admin toolbar, clicking on the block configuration, then we're going to click on the gear icon. So from here, the first thing that pops up, and you may have messed with this before if you've tried to output the results to Lava or SQL for something that hasn't yet been enabled, And this is for security purposes.
If you're using Lava or certain commands or SQL, for example, then you need to enable it here so that it's available. Then if you want to more often start in code editor mode rather than in the what you see is what you get editor where you can do HTML things with plain text. If you want to be in code editor mode, when you start, then you'll want to say yes here, then the document root folder. So when you're using documents within the HTML block, This allows you to basically pick whatever path you want to be prepended when you're looking through documents. So for example, if you wanna gate off content, you could say slash content slash websites.
And now anytime you go to look for a document, it will only show documents under the websites folder rather than all of them under content. You can also do this same thing for images. Now user specific folders. What this does is if you want, when people are using folders within the HTML block, for people to only use ones that are specific to them, you can say user specific folders, yes. And in this case, I'm signed in as Alicia Marble.
So I would basically, as I add files or other things, I'll only be able to access those files and documents that are within my user specific folder. So this brings some safety and also it allows you to just organize things based on who added stuff. Then cache duration. So this is set to zero here. And the reason we have it set to zero is because often if you're using Lava, say you have a filter or something and you're dynamically showing the person's name on the page.
If you were caching that information, meaning, , temporarily storing it, then every time someone came to the page, they would see the information from the last person who logged in and their information would be cached. Now there are lots of opportunities or times when content isn't personalized though, and you would benefit from caching it. So you could say 3,600, and this is simply the number of seconds that you wanna cache content for. I'm gonna remove that for now though. Then context parameter.
So this is helpful when you wanna change the content that's shown based on the parameter in the link. So let's just say parameter, and I know that's goofy. This isn't how you'd usually use it, but I am going to copy this. We'll save. And what we're gonna do is before a parameter, always put a question mark, then we'll do the parameter equals one.
So now we're on the page with the context of the parameter being one. We can say this is one and save it. Now you'll notice when we update the context, that content is gone. So now we actually have a new context and we can say, this is two. You can do this for all sorts of parameters and dynamically give people links.
For example, say you wanted to share this page with someone and you wanted them to see a specific content, then you could put in a parameter that makes sense with info that pertains to them such as person ID of blank, and that person would specifically see whatever content is there for them. Just to show you how this works again, I'll go back to one and we can see that content we added is still there. But we're gonna go back to the settings, and I'm going to remove this parameter. We're gonna do something else. I'm just gonna save to refresh it.
Now I'm gonna remove this. And back to the settings, we're gonna do something called context name. So let's just do this. We'll type in test and I'm gonna edit the content here. And to explain what this does, I'll just give you an example.
We'll just say this is test content. So now anything we save here has the context name of test. And the way we access this is if we go to a different HTML block, we can go edit the settings for it and type in the context name that we just used and boom, there. Now the content we put in on the other HTML block is shown here as you can see. So this is really helpful if you want to access content across multiple different HTML blocks.
Now we'll go back to this first block and the settings, and I'm going to clear the context name here. So some more things you can do, versioning. Versioning is really helpful. I'll show you what this looks in just a moment. Also require approval.
Let's just say yes for now so you can see what approvals do. They essentially allow you as you update the block. You can have people in a security role who are allowed to pick whether or not an HTML block change is approved or denied. Then cache tags, this is a different feature which we explain in a different video, but you can basically use these tags so that you can easily track where things are cached and flush the cache for all of them at once. Then is secondary block, this is a setting that indicates whether this block is considered secondary and should be hidden when other secondary blocks are hidden.
There's some circumstances in which you'd want to do that. Then validate markup, This basically, if it's enabled, the HTML markup will be validated to make sure no tags are mismatched. Now, if you don't want that to happen, you can just click no here. Context, this is just for if you need to pass in an entity. For example, if you're using a filter in Lava that needs to have the context of what entity is needed to be passed in, you can do that here.
But in most cases, you won't need to enable anything. But let's look at versioning and approval. So to see versioning, we'll go back to edit the HTML, and immediately, we can see we now have history available, display from, don't save as a new version, and approvals. So let's just say this is test content. I have edited it.
And I'm going to save, then go back to this block. And I'm going to say I have edited it again. And I'm gonna save it again back to this block. Now we're on a new version. And first of all, one thing to note is that Alicia Marble is in an approvals role, so these updates are automatically being approved.
But from this dialogue, you can pick whether or not changes are approved if you have the permission. And by clicking history, we can see even since before we enabled version tracking, we have this list of versions showing the changes we've made and we can actually really easily revert back to an old one. So here we go. We have content that we used to have before we made a change. We're in version one of two.
This is helpful for those HTML blocks that are carrying a large load. Maybe they get updated regularly and you just want a history of what's been changing. Also, you make a small edit and you don't want it to save as a new version, you can easily skip that by pressing this. Or if you have a version that you only want to display between different dates, say you have a Christmas message and you wanna say Merry Christmas, it only shows up during certain dates, Then once these this display window is done, it'll revert back to the last version before that that has an eligible set of dates. There you go.
Now one thing more on approvals, if we go edit this block and look at the security, we can see who has approval settings, and it's those in the Rock administration role have this permission. To approve content, you need to go to tools and then HTML content approval. Now if there is anything that had been submitted and this person didn't have permission to approve, then I would have the option here to I can, first of all, see what content is new, then I can pick whether or not it's approved from here. Now you can track versioning, do some special styling and more using the HTML block. I hope now your mind is opened to how flexible this block is and you can do some cool things in Rock.