Adding images to blocks on homepage
RespondidaHi all! Wondering how to add images or illustrations to the article blocks on the homepage of my company's guide (https://cqhelp.zendesk.com/hc/en-us).
I'd like to be able to add different images to each block, but can't find a way to differentiate each.
In a perfect world, the block would be hyperlinked to the article page as well, rather than just the 'see all articles' CTA.
Any thoughts?
-
Laura Harvey
you can mimic the snippet below to your home_page.hbs file. We use this to feed images/icons to our category types, then change where Resource Center is the category name, to whichever category you would like to display an image for and the image asset tag (we set the width to ensure it wasn't oversized since we use svg's).{{#is name 'Resource Center'}}
<img src="{{asset 'image_name-.svg'}}" width=50px />
{{/is}}
The result should look like this:If you want the category to link somewhere else, the below snippet we use in our script.js file, after the document ready function. Just replace the location URL at the end that starts with /hc/.. to your desired page.
//Resource Center Redirect
$('a').each(function() {
var value = $(this).attr('href');
if(value=='/hc/en-us/categories/360003115091-Resource-Center')
{
$(this).attr('href', '/hc/en-us/articles/Your_article_title_here');
}
});
Por favor, entrar para comentar.
1 Comentários