external_link metadata configuration #41
Replies: 1 comment 1 reply
-
@wvlibrarycommission thanks for reaching out (and for the detailed info)! Yeah, the "external_link" option was added to CB-GH and is in the Docs --> but as you have discovered it wasn't ever implemented in CB-CSV. Sorry about that--CSV is still actively developing and not everything matches the Docs exactly yet. Glad you figured out a fix that works for you. I just added the external_link option to CB-CSV, so you can see how I did it in "_includes/item/metadata.html". This is a bit different than your version, since it displays the "display_name" and then shows the full link and makes it clickable (opening in a new tab). An alternative that might make sense in your use case would be to add a button to the item page "download buttons" instead of displaying the link in the metadata section. You could edit "/_includes/item/download-buttons.html" to add another button similar to the logic you added to the metadata include. e.g. you could add this to the download-buttons.html:
Let us know how it goes and if you have any other questions! |
Beta Was this translation helpful? Give feedback.
-
Project Repository: https://github.com/wvlibrarycommission/cabellcountydl-cb
Team Member Tags: @evanwill @owikle @dcnb
I'm working with CollectionBuilder CSV.
Hello! We're considering CollectionBuilder for several projects, one of which may have some records that link to the digital item's record in its home repository.
As I understand it, the "external_link" column in config-metadata.csv is meant to make the contents of a that column a live, clickable link if set to true. I did this for the field isShownAt, and the data displayed on the item page, but it was simply text. The link could not be clicked. It had to be copied and pasted. (If you want to take a look, the only object that has something in this field at this time is bowden_01.jpg, which has objectid cabell_example_003 .
After falling through a lot of rabbit holes and reading lots of code, it appeared to me that there was no logic in \cabellcountydl-cb_includes\item\metadata.html that would generate a link if external_link was set to true.
So I added a bit of conditional code to this for loop in metadata.html. I've pasted the section I updated below.
{% for f in fields %}{% if page[f.field] %} {% if f.external_link == "true" %} <dt class="field"> <a href="{{ page[f.field] }}">{{ f.display_name }}</a> </dt> {% else %} <dt class="field">{{ f.display_name }}:</dt> <dd class="field-value"> {% if f.browse_link == "true" %} {% assign topics = page[f.field] | split: ";" %} {% for t in topics %} <a class="mr-3" href="{{ t | strip | url_param_escape | prepend: '/browse.html#' | relative_url }}">{{ t | strip }}</a> {% endfor %} {% else %} {{ page[f.field] | replace: '""','"' }} {% endif %} </dd> {% endif %} {% endif %} {% endfor %}
It works now, but I'm not sure this is the best way to go about it.
Am I missing something obvious? It wouldn't be the first time... Is external_link actually broken, or was I just doing something wrong?
Many, many thanks! This is such a great tool.
Gena Chattin
West Virginia Library Commission
Beta Was this translation helpful? Give feedback.
All reactions