0

We are working on Sitecore 9.0.2 & SXA 1.7.1 and we need to develop a hero component and we have following requirement

1) Title of Hero Image needs to come from body of another the news article page and need to pick first 10-15 words

2) We need to give author feature to select News Article Pages while he is doing content Authoring for Hero Image.

Is there any way we can do this OOB.

Cheers

2
  • I would definetely copy existing component "Promo" and create your own "Hero Image" based on it. Follow this guideline -> doc.sitecore.net/sitecore_experience_accelerator/… . You can use existing Link field from Promo to link your Hero Image with News Article and alter rendering variant to show fields as you need based on linked content. I am not next to computer to give you detailed answer. Try to follow this comment for now. Should guide you to right direction... Commented Nov 2, 2018 at 12:07
  • I looked at this and explored this it seems this still has to be custom component right. Commented Nov 2, 2018 at 12:37

2 Answers 2

1

Yes - you could do this with a Page Content component and a Rendering Variant.

I would advise against trying to get the first 10-15 words of the article because that will be tricky to pull out of a Rich Text field that also contains markup. Instead it would be better to add a Blurb or Navigation Content field to the article where the author can write specific content for the navigation/hero piece.

Create a Page Content rendering variant and add the required variant fields/markup for the Hero Image and the Blurb content. Then when your content editor adds the component to a page, train them that they need to add a datasource to it by setting the associated content.

If you absolutely have to pull out the 10-15 words, you would need to look at using an nvelocity template and writing a custom field parser for nvelocity that you could call in the template.

0

@user2332873 - I think I have a good news for you!

Refer this link which was very helpful for me in a similar task as yours - Creating a news blog using SXA. You will be having step by step instructions on its implementation with extra features like buckets,tag cloud, tag list, load more, pagination etc.., that might be you of great use to your task!

For you first requirement,

1) Title of Hero Image needs to come from body of another the news article page and need to pick first 10-15 words

Yur solution can be - as mentioned in this blog, where you can have two fields 1)Introduction (this field will have the first 10-15 words) and 2) Content (this field will have the whole content beginning from the first 10-15 words in Introduction field) and use rendering variants pointing to these fields

I think you have answer as for your second requirement from Richard Seal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.