Selectively display attachments in Guide articles
Answered
Posted Sep 29, 2023
In Guide, for some articles I want to link to an article attachment in the body of the article rather than have the attachment shown at the bottom of the article. I know that in style.css I can hide displaying attachments for all articles:
.article-attachments {
display: none;
}
What I want is to be able to do the above but selectively per article without having to modify a conditional section in a hbs file with specific article IDs. Is this possible in the CSS?
3
4
4 comments
Daniel Corriveau
How come when I put this at the bottom of my style.css the attachment are still appearing in the articles?
.article-attachments {
display: none;
}
0
Tom Richards
1266414668650
I've done this as well on occasion, but what spurred my question is my dislike for having both a link in the body and an attachment at the bottom.
By definition an attachment is something at the bottom of an article, so it makes sense why they show there. What we (and a few others) are looking for is a simple way to, in the article body, link to a document stored in the zendesk domain, which is what your workaround does.
An alternative to your step 1 is to attach the document to another article altogether, e.g., an article whose sole purpose is attaching things to. Then the doc won't also appear as an attachment in the article where you've linked to it in the body. The caveat is to make sure the permissions on the article it's attached to are not more restrictive than the one that is linking to it.
0
Cameron | Traeger
1263169168130,
This is something I've been trying to figure out since we migrated our help center to Zendesk two years ago! I think it's ridiculous that attachments only appear at the bottom, especially when wanting to attach/link/display something like a product manual or assembly guide into a table.
The workaround I found this morning is a bit arduous, but it works!
If anyone out there has a better way, I'm all ears :)
0
Ifra Saqlain
@Tom Richards,
only with CSS, I don't think it's possible but you can use JS to achieve this instead of checking IDs on hbs file.
if (window.location.href.indexOf("000000000000") > -1) { document.querySelector(".article-attachments").style.display = "none"; } else if (window.location.href.indexOf("11111111111111") > -1) {
document.querySelector(".article-attachments-for-body").style.display = "block";
}
Note: for this, you need to add an attachment code block inside the article body as you want to do,
then hide that on all articles but show only on your specific article where you want to show that and you need to hide
that second attachment code, which is already there, hide on your specific article using JS by checking the
article IDs.
If any confusion feel free to ask :)
Thanks
0
Sign in to leave a comment.