Mar 30 2023 04:07 AM
I am building a SharePoint classic web part page with several Content Query Web Parts on and am also using a query string in the URL. The CQWP have a filter to only show results if URL Query String is equal to a 'Category' value from the document library. This part is all working fine.
However, at the top of the page, I need to add a paragraph/bullet points which will be different for each category. I have tried creating a separate list and adding each bullet point as a list item and then having another column titled 'Category' which I can map to the page query string, which looks to display okay using another CQWP, however the links are clickable on the SharePoint page when I don't want them to be.
Is there a way to disable the hyperlinks just for this one CQWP? Otherwise, is there an alternative way, we can get a different paragraph/bullet points to display depending on the page query string without having to manually created hundreds of pages?
Mar 30 2023 06:24 AM
@Sam1209 If you have created a list with columns like: Category and Description, you can use SharePoint REST API in script editor/content editor web part to get the description corresponding to category you get from URL.
Check this to get category from URL using Javascript: How can I get query string values in JavaScript?
Then use REST API query like:
https://contoso.sharepoint.com/sites/SiteName/_api/web/lists/getbytitle('List Name')/items?$select=Category,Description&$filter=Category eq '<category-value-from-URL>'
Then you can bind the returned results to SharePoint UI using HTML/JavaScript.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs