pratik
pratik

@sod I was looking at @heyloura's code for displaying the bookmarks on a page with their tags. I was going to look into adding a filter to only display bookmarks for a certain tag. Are you planning on updating your plug-in, and displaying and filtering tags will be part of it?

|
Embed
heyloura
heyloura

@pratik You can add a filter on the tags in the bookmarks plugin by using another if-statement. Here is an updated piece of code demonstrating the change. For example, if I wanted to filter on bookmarks I've tagged as "code". You would add the line {{ if (strings.Contains .tags "code") }} and then a closing {{ end }} after the display HTML. You can find some sample code here. You could also swap the strings.Contains for eq if you wanted an exact match.

|
Embed
pratik
pratik

@heyloura Awesome! Thanks a lot.

|
Embed
pratik
pratik

@heyloura, One quick question. The displayed bookmarks don't respect the line breaks in the posts or rather the HTML/Markdown is stripped off. Any way to fix that? Since these are a max of 600 chars, I don't mind displaying them as posted.

|
Embed
sod
sod

@pratik Hehe, thanks again for helping me with support, @heyloura. You're the best! 🎉 Sorry it's such a poorly paid job. 😊

|
Embed
pratik
pratik

@sod Awww! I thought you were doing it out of love 🙃

|
Embed
heyloura
heyloura

@sod No problem 😁

|
Embed
heyloura
heyloura

@pratik It's something you can do, though it's not recommended. The term plainify in the code is what's stripping the tags. Removing that will show the content with HTML tags as text. You'd have to flag Hugo that the content is safe HTML for it to render as HTML. It's a safety precaution against potentially malicious code.

|
Embed
pratik
pratik

@heyloura Ah! Yup, I tried taking out the plainify after I messaged you but yup, HTML tags are visible. Not sure how to flag Hugo but I'm guessing that's how it is set up at Mb

|
Embed