setting custom Atom document partial?

23 views
Skip to first unread message

jona...@dnil.net

unread,
Sep 20, 2022, 11:11:21 AM9/20/22
to Blacklight Development
Hi, looking at the code that produces atom responses from search results, this line is intriguing:


It looks to me like I ought to be able to set blacklight_config to use a custom partial to produce the per-document `<entry>` element in an Atom response, that by default is coming from `app/views/catalog/_document.atom.builder`. 

I'd like to do just that!

But I've been unable to figure out anything I can set in my blacklight config settings to succesfully override this to something local. 

I first naively tried (in my CatalogController `configure_blacklight do`) :

   config.view.index.atom = "my_partial"

Then, after spending more time trying to reverse engineer the code, I tried:

   config.view[:atom].partials = [:my_partial]

So far I haven't been able to come up with anything that actually changes Blacklight to use my custom local partial instead of `app/views/catalog/_document.atom.builder`

Does anyone know if there is a way to do this, and what it is?

Also, if there IS a way to do it -- but it might be especially likely to break in a future BL version, perhaps because someone already has designs on replacing this portion of BL code (perhaps with view_component stuff?) -- let me know that too!  If, even if I figured out how to do this, it is likely not to be forwards-compatible -- then I'll probably avoid it and just override the whole atom response at a higher level instead of trying to surgically configure just the document atom partial. 

Thanks for any advice or ideas!

Jonathan

Alex Romanin

unread,
Dec 6, 2022, 10:50:50 PM12/6/22
to Blacklight Development
This might sound naive but I don't think it's overridable in any better way other than by copying the entireity of index.atom.builder into your local app/views/catalog directory and setting your custom list of partials in that line you referenced. I'm struggling to override another bit of the codebase as well but I know little about Ruby or Rails. What was your approach in the end? 
Kind regards,
Alex
Reply all
Reply to author
Forward
0 new messages