[Archivesspace_Users_Group] need help customizing text in ArchivesSpace
Majewski, Steven Dennis (sdm7g)
sdm7g at virginia.edu
Mon Dec 9 15:40:52 EST 2019
"Welcome to ArchivesSpace” is en.brand.welcome_message :
en:
brand:
title: ArchivesSpace Public Interface
title_link_text: Return to the ArchivesSpace homepage
home: Home
welcome_head: Welcome to ArchivesSpace
welcome_message: |
<p>Search across our collections, digital materials, and more.</p>
welcome_search_label: "Find what you're looking for:"
welcome_page_title: ArchivesSpace Public Interface
And the default welcome_message above is html with paragraph tags. So you should be able to include multiple paragraphs or other markup or styling.
If you want to make deeper changes, you want to edit the view templates and add them to the local plugin as well.
Read the Rails Guide for Layout and Rendering: https://guides.rubyonrails.org/layouts_and_rendering.html <https://guides.rubyonrails.org/layouts_and_rendering.html> along with the ArchivesSpace docs on customization.
If you view the log file when you are accessing a page, you will see which controller is called as well as all of the views that are rendered for the page requested:
[java] I, [2019-12-09T14:42:51.500361 #52422] INFO -- : Started GET "/" for 0:0:0:0:0:0:0:1 at 2019-12-09 14:42:51 -0500
[java] I, [2019-12-09T14:42:51.626236 #52422] INFO -- : Processing by WelcomeController#show as HTMLI, [2019-12-09T14:42:51.626918 #52422] INFO -- : Processing by WelcomeController#show as HTML
[java]
[java] I, [2019-12-09T14:42:52.917277 #52422] INFO -- : Rendering welcome/show.html.erb within layouts/application
[java] I, [2019-12-09T14:42:52.961968 #52422] INFO -- : Rendered shared/_search.html.erb (25.9ms)
[java] I, [2019-12-09T14:42:52.963225 #52422] INFO -- : Rendered welcome/show.html.erb within layouts/application (45.1ms)
[java] I, [2019-12-09T14:42:52.917654 #52422] INFO -- : Rendering welcome/show.html.erb within layouts/application
[java] I, [2019-12-09T14:42:52.962609 #52422] INFO -- : Rendered shared/_search.html.erb (25.9ms)
[java] I, [2019-12-09T14:42:52.963542 #52422] INFO -- : Rendered welcome/show.html.erb within layouts/application (45.1ms)
[java] I, [2019-12-09T14:43:05.707996 #52422] INFO -- : Rendered shared/_metadata.html.erb (5.5ms)
[java] I, [2019-12-09T14:43:05.708551 #52422] INFO -- : Rendered shared/_metadata.html.erb (5.5ms)
[java] I, [2019-12-09T14:43:05.719336 #52422] INFO -- : Rendered shared/_skipnav.html.erb (4.8ms)
[java] I, [2019-12-09T14:43:05.731258 #52422] INFO -- : Rendered shared/_header.html.erb (8.2ms)
[java] I, [2019-12-09T14:43:05.749501 #52422] INFO -- : Rendered shared/_navigation.html.erb (12.5ms)
[java] I, [2019-12-09T14:43:05.718912 #52422] INFO -- : Rendered shared/_skipnav.html.erb (4.8ms)
[java] I, [2019-12-09T14:43:05.730940 #52422] INFO -- : Rendered shared/_header.html.erb (8.2ms)
[java] I, [2019-12-09T14:43:05.749000 #52422] INFO -- : Rendered shared/_navigation.html.erb (12.5ms)
[java] I, [2019-12-09T14:43:05.758603 #52422] INFO -- : Rendered shared/_footer.html.erb (4.1ms)
[java] I, [2019-12-09T14:43:05.760572 #52422] INFO -- : Completed 200 OK in 14131ms (Views: 12860.0ms)
[java]
The likeliest templates to modify for branding are probably welcome/show, shared/_header, shared/_footer, and maybe shared/_search .
If you look at public/app/views/welcome/show.html.erb, all of those t() function calls are getting locale translations, so if your locale is English,
t( ‘brand.welcome_message’ ) is replaced by the value of en.brand.welcome_message. So you need to look at the page templates if you want to know where some particular text comes from. ( Sometimes, easier to go the other direction: search for a particular text like “Welcome to ArchivesSpace” in .yml files, then ack thru the view templates for ‘brand.welcome_head’ to see where it’s used. )
If you want to make changes to that page, copy it into plugins/local/public/views/welcome/show.html.erb ( after creating needed directories )
Any other views you change should be similarly be copied into the corresponding position in plugin directory.
<div class="row">
<div class="col-sm-12">
<h2><%= t('brand.welcome_head') %></h2>
<div> <%= t('brand.welcome_message').html_safe %> </div>
</div>
</div>
<%= render partial: 'shared/search', locals: {
:search_url => "/search",
:title => t('archive._plural'),
:limit_options => [
["#{t('actions.search')} #{t('search-limits.all')}",''],
[t('search-limit', :limit => t('search-limits.resources')),'resource'],
[t('search-limit', :limit => t('search-limits.digital')),'digital_object']
],
:field_options => [
["#{t('search_results.filter.fullrecord')}",''],
["#{t('search_results.filter.title')}",'title'],
["#{t('search_results.filter.creators')}",'creators_text'],
["#{t('search_results.filter.subjects')}",'subjects_text'],
["#{t('search_results.filter.notes')}", 'notes'],
["#{t('search_results.filter.identifier')}", 'four_part_id']
]
} %>
One template that you don’t change is public/app/views/layouts/application.html.erb, which is the top level layout that handles the HTML header and shared markup for all of the pages ( i.e. header, footer, navigation, etc. ) . Instead, each plugin can include a views/layout_head.html.erb file, which are included in the HTML header by that application.html.erb template. This is where you can stick custom javascript or css links.
> On Dec 9, 2019, at 2:31 PM, Janet Hack <jhack at mcdaniel.edu> wrote:
>
> That looks like it worked - thanks for your help.
>
> A few more questions:
> Is it possible to change the wording of the heading "Welcome to ArchivesSpace"?
> How can we add line breaks to the Welcome message?
> Thanks.
>
> - Janet
>
> -----------------
> Janet Hack
> Science and Online Technologies Librarian
> Hoover Library | McDaniel College
> 2 College Hill | Westminster, MD 21157-4390
> 410-857-2283 | jhack at mcdaniel.edu <mailto:jhack at mcdaniel.edu>
> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Majewski, Steven Dennis (sdm7g) <sdm7g at virginia.edu>
> Sent: Monday, December 9, 2019 2:06 PM
> To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
> Subject: Re: [Archivesspace_Users_Group] need help customizing text in ArchivesSpace
>
> There shouldn’t be a text value after ‘brand:’
> The value of en.brand is the hash of the following values, so that en.brand.title, for example, maps to a value.
> If you take out that text it should work:
>
> en:
> brand:
> title: McDaniel College Archives Catalog
> home: Home
> welcome_message: HEY HEY HEY! !
>
>
> Error message is a bit confusing, but it’s trying to say it can’t assign mappings of title, home, welcome_message, to en.brand because it already has a string value of “McDaniel Archives” .
>
>
>> On Dec 9, 2019, at 1:34 PM, Janet Hack <jhack at mcdaniel.edu <mailto:jhack at mcdaniel.edu>> wrote:
>>
>> So, I finally got some time to get back to this and still can't get it to work.
>>
>> After updating the en.yml file located at plugins/local/public/locales/ to the following:
>>
>> en:
>> brand: McDaniel Archives
>> title: McDaniel College Archives Catalog
>> home: Home
>> welcome_message: HEY HEY HEY! !
>> and restarting the server, I get the following fatal error message in the log:
>> I18n::InvalidLocaleData (can not load translations from /opt/archivesspace/archivesspace-2.7.0/plugins/local/public/locales/en.yml: #<Psych::SyntaxError: (/opt/archivesspace/archivesspace-2.7.0/plugins/local/public/locales/en.yml): mapping values are not allowed here at line 3 column 8>
>> Any suggestions would be greatly appreciated.
>>
>> - Janet
>>
>> -----------------
>> Janet Hack
>> Science and Online Technologies Librarian
>> Hoover Library | McDaniel College
>> 2 College Hill | Westminster, MD 21157-4390
>> 410-857-2283 | jhack at mcdaniel.edu <mailto:jhack at mcdaniel.edu>
>> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> <archivesspace_users_group-bounces at lyralists.lyrasis.org <mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> on behalf of Majewski, Steven Dennis (sdm7g) <sdm7g at virginia.edu <mailto:sdm7g at virginia.edu>>
>> Sent: Friday, November 22, 2019 3:02 PM
>> To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org <mailto:archivesspace_users_group at lyralists.lyrasis.org>>
>> Subject: Re: [Archivesspace_Users_Group] need help customizing text in ArchivesSpace
>>
>>
>>
>>> On Nov 22, 2019, at 2:49 PM, Blake Carver <blake.carver at lyrasis.org <mailto:blake.carver at lyrasis.org>> wrote:
>>>
>>> I think that doc is out of date, this might be more update:
>>> https://github.com/archivesspace/tech-docs/blob/master/customization/locales.md <https://github.com/archivesspace/tech-docs/blob/master/customization/locales.md>
>>>
>>>
>>
>>
>> Although, that doc has an error in the whitespace/indentation of the example. “brand:” should be less indented. — Steve.
>>
>>
>>>
>>> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> <archivesspace_users_group-bounces at lyralists.lyrasis.org <mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> on behalf of Majewski, Steven Dennis (sdm7g) <sdm7g at virginia.edu <mailto:sdm7g at virginia.edu>>
>>> Sent: Friday, November 22, 2019 2:24 PM
>>> To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org <mailto:archivesspace_users_group at lyralists.lyrasis.org>>
>>> Subject: Re: [Archivesspace_Users_Group] need help customizing text in ArchivesSpace
>>>
>>> One thing to check: the spaces and indentation in .yml files are significant, and you can’t mix tabs(*) with spaces, so you should make sure that you haven’t accidentally inserted a tab when editing. You can edit the file in place for testing, but for normal production, I advise copying the values you want to change into plugins/local/public/locales/en.yml and editing them there. But again, you have to be careful to preserve .yml hierarchy.
>>>
>>> You may also eventually want to try copying some of the shared view templates into plugins/local/public/views/shared/ and editing those.
>>> It’s easier to manage upgrades if you keep your changes in plugins directories.
>>>
>>> (*) In fact, googling this, I see it doesn’t like tabs at all. Must be only spaces.
>>>
>>>
>>> — Steve M.
>>>
>>>
>>>
>>>> On Nov 22, 2019, at 1:50 PM, Janet Hack <jhack at mcdaniel.edu <mailto:jhack at mcdaniel.edu>> wrote:
>>>>
>>>> Greetings,
>>>>
>>>> we are new to ArchivesSpace and are trying to change the wording on our public-facing pages https://archivesspace.mcdaniel.edu/ <https://archivesspace.mcdaniel.edu/>. We want to change the header title from the standard "ArchivesSpace Public Interface" and we would like to put in a custom welcome message. I have tried editing the en.yml file following the instructions at https://archivesspace.github.io/archivesspace/user/customizing-text-in-archivesspace/ <https://archivesspace.github.io/archivesspace/user/customizing-text-in-archivesspace/> with no success.
>>>>
>>>> Any assistance would be greatly appreciated. Please feel free to contact me off-list.
>>>>
>>>> - Janet
>>>>
>>>> -----------------
>>>> Janet Hack
>>>> Science and Online Technologies Librarian
>>>> Hoover Library | McDaniel College
>>>> 2 College Hill | Westminster, MD 21157-4390
>>>> 410-857-2283 | jhack at mcdaniel.edu <mailto:jhack at mcdaniel.edu>_______________________________________________
>>>> Archivesspace_Users_Group mailing list
>>>> Archivesspace_Users_Group at lyralists.lyrasis.org <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
>>>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>>> _______________________________________________
>>> Archivesspace_Users_Group mailing list
>>> Archivesspace_Users_Group at lyralists.lyrasis.org <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
>>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> Archivesspace_Users_Group at lyralists.lyrasis.org <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20191209/356d85bf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4974 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20191209/356d85bf/attachment.bin>
More information about the Archivesspace_Users_Group
mailing list