EPrints Technical Mailing List Archive
Message: #00096
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Re: multilang eprints.* fields show up as HASH(0xhexnumber) in html head
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] Re: multilang eprints.* fields show up as HASH(0xhexnumber) in html head
- From: Dobrica Pavlinušić <dpavlin@gmail.com>
- Date: Tue, 6 Mar 2012 02:24:27 +0100
If anybody cares, those meta fields are generated in EPrints/Plugin/Export/Simple.pm and attached patch adds multilang support by simple copy/paste from DC.pm 2012/3/2 Dobrica Pavlinušić <dpavlin@gmail.com>: > We are using eprints 3.3.8 from Debian package and decided to use > multilang fields for title, keywords and abstracts to provide English > translation along with our Croatian originals. > > However, when EPrints generates <meta> tags we get something like this: > > <meta name="eprints.title" content="HASH(0xfc3107a8)" /> > <meta name="eprints.ispublished" content="submitted" /> > <meta name="eprints.subjects" content="SOC" /> > <meta name="eprints.full_text_status" content="public" /> > <meta name="eprints.keywords" content="HASH(0xfc236248)" /> > <meta name="eprints.keywords" content="HASH(0xfc301f40)" /> > <meta name="eprints.abstract" content="HASH(0xfc315c48)" /> > <meta name="eprints.abstract" content="HASH(0xfc330770)" /> > > This makes *some* sense, because we have one title, and multilang > keywords and abstract for this entry, however I would love to have > text inside content. This is especially bad for Google Scholar and > other crawlers (including Zoterro) which seem to prefer eprints.* meta > fields as opposed to DC.title and/or DC.subject. > > I should also stress out that DC.* meta fileds are correctly generated > (once, using default language to select one of available values). > > I did try to find my way through source code using grep, but I'm stuck > where to look. Any help is greatly appreciated. > > -- > ...2share!2flame... http://blog.rot13.org > > *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech > *** Archive: http://www.eprints.org/tech.php/ > *** EPrints community wiki: http://wiki.eprints.org/ -- ...2share!2flame... http://blog.rot13.org
diff --git a/eprints/usr/share/eprints3/perl_lib/EPrints/Plugin/Export/Simple.pm b/eprints/usr/share/eprints3/perl_lib/EPrints/Plugin/Export/Simple.pm index 05b58d5..f0fe572 100644 --- a/eprints/usr/share/eprints3/perl_lib/EPrints/Plugin/Export/Simple.pm +++ b/eprints/usr/share/eprints3/perl_lib/EPrints/Plugin/Export/Simple.pm @@ -120,7 +120,19 @@ referencetext / ) next unless $eprint->is_set( $fieldname ); my $field = $dataset->get_field( $fieldname ); my $value = $eprint->get_value( $fieldname ); - if( $field->get_property( "multiple" ) ) + if( $field->isa( "EPrints::MetaField::Multilang" ) ) + { + my( $values, $langs ) = + map { $_->get_value( $eprint ) } + @{$field->property( "fields_cache" )}; + $values = [$values] if ref($values) ne "ARRAY"; + $langs = [$langs] if ref($values) ne "ARRAY"; + foreach my $i (0..$#$values) + { + push @epdata, [ $fieldname, $values->[$i] ]; #, { lang => $langs->[$i] } ]; + } + } + elsif( $field->get_property( "multiple" ) ) { foreach my $item ( @{$value} ) {
- References:
- [EP-tech] multilang eprints.* fields show up as HASH(0xhexnumber) in html head
- From: Dobrica Pavlinušić <dpavlin@gmail.com>
- [EP-tech] multilang eprints.* fields show up as HASH(0xhexnumber) in html head
- Prev by Date: [EP-tech] File icons in 3.3?
- Next by Date: [EP-tech] Message when installing IRStats -- UNIVERSAL->import is deprecated and will be removed in a future perl at /usr/share/eprints3/perl_lib/IRStats/Params.pm line 4
- Previous by thread: [EP-tech] multilang eprints.* fields show up as HASH(0xhexnumber) in html head
- Next by thread: [EP-tech] Re: multilang eprints.* fields show up as HASH(0xhexnumber) in html head
- Index(es):