Icon before article title
Answered
Posted Feb 26, 2020
Hi everyone!
I always seem to have a lot of questions. Maybe one day I can actually help someone else out!
We would like to add an icon before certain articles that show that an article is about a new feature or is updated. We can do that with text or adding an emoji, but I would like to use some of our branding instead. This would require a way to add a jpg, png, etc to the front of an article title. How can I do this?
See the icon on Twitter below. Thanks!
0
30
30 comments
Ifra Saqlain
Hi Marsy,
There is easy and simple way,
Go to the section_page.hbs file.
Check the section id.
Add icon on section page like below:
If any confusion let me know :)
Thanks
0
Marsy
Hello, I am trying to add icons to sections before the title name. Do you happen to have any suggestions on coding for this? I tried a few variations that are not working for me.
0
Ifra Saqlain
Glad to hear that it worked for you!
0
Ashley Boose
Ifra, you're amazing! That worked perfectly. I appreciate you taking the time to help me with this so much--you have no idea. Thank you, thank you!
0
Ifra Saqlain
Hey Ashley Boose,
Remove previous line of code and use this code snippet:
0
Ashley Boose
Hey Ifra, I have added all the code as you said. I added the following to my script.js file:
I added the following to my section, category and article pages in the place(s) that you specified:
Then I added the following to the document_head.hbs file:
Now the lock icon IS showing up on the article where that label has been added, but the only problem I'm still having is that all the other articles that have other labels are showing the label names by the titles in the category, section and article pages as well. (See screenshots.) From what I listed above, can you tell what I could've done to make this happen?
0
Ifra Saqlain
Hey Ashley Boose
Add this script code to your script.js file at the bottom as well (I have mentioned in my above comment):
and make sure your document_head.hbs file has this CDN like below:
If any confusion, let me know :)
0
Ashley Boose
Hey Ifra, thank you so much for helping me with this, I really appreciate it. I am having one issue though. I added the code as you said, but I think instead of showing the icon on the article with the specific label, it is showing the labels for each article next to the titles for any/all articles that have them. (Screenshots of section page and article below).
0
Ifra Saqlain
Hi Ashley Boose,
If you added a "Labels" to your articles for your "Gated Access" users I mean like this,
add the script code to the script.js file at the bottom area,
then check the label with the given code by adding to category, section and article page same as I shared the screenshots,
Try this and let me know :)
Thanks
0
Ashley Boose
Thank you Ifra for your quick response! I understand that the lock icon will show up when article is visible to Agents and Admins only, and ours does this. However, we have created a custom segment called "Gated Access" that is visible to Agents and Admins AND a few other specific end-users that are partners of our company. We would like to be able to flag these articles as internal as well, but of course the lock icon doesn't show up for these articles. Also, there is no way to identify these articles, that I know of, in order to add the icon via Javascript or anything else. Do you have any ideas for me on this? Even if I just wanted to manually add the icon in each article title, I can't think of a way to add one that would work unless it's a symbol and even then it looks like this: 🔒.
0
Sign in to leave a comment.