@@ -268,9 +268,7 @@ export class MetadataService {
268268 * Add <meta name="citation_author" ... > to the <head>
269269 */
270270 private setCitationAuthorTags ( ) : void {
271- // limit author to first 20 entries to avoid issue with item page rendering
272- const values : string [ ] = this . getMetaTagValues ( [ 'dc.author' , 'dc.contributor.author' , 'dc.creator' ] )
273- . slice ( 0 , this . appConfig . item . metatagLimit ) ;
271+ const values : string [ ] = this . getMetaTagValues ( [ 'dc.author' , 'dc.contributor.author' , 'dc.creator' ] ) ;
274272 this . addMetaTags ( 'citation_author' , values ) ;
275273 }
276274
@@ -720,18 +718,19 @@ export class MetadataService {
720718 return this . currentObject . value . allMetadataValues ( keys ) ;
721719 }
722720
723- protected addMetaTag ( name : string , content : string , isProperty = false ) : void {
721+ protected addMetaTag ( name : string , content : string , isProperty = false , isMultiple = false ) : void {
724722 if ( content ) {
725723 const tag = isProperty ? { name, property : name , content } as MetaDefinition
726724 : { name, content } as MetaDefinition ;
727- this . meta . updateTag ( tag ) ;
725+ isMultiple ? this . meta . addTag ( tag ) : this . meta . updateTag ( tag ) ;
728726 this . storeTag ( name ) ;
729727 }
730728 }
731729
732730 private addMetaTags ( name : string , content : string [ ] ) : void {
733- for ( const value of content ) {
734- this . addMetaTag ( name , value ) ;
731+ // limit meta tags with the same name to avoid issues with page rendering
732+ for ( const value of content . slice ( 0 , this . appConfig . item . metatagLimit ) ) {
733+ this . addMetaTag ( name , value , false , true ) ;
735734 }
736735 }
737736
@@ -746,7 +745,9 @@ export class MetadataService {
746745 take ( 1 )
747746 ) . subscribe ( ( tagsInUse : string [ ] ) => {
748747 for ( const name of tagsInUse ) {
749- this . meta . updateTag ( { name, content : '' } ) ;
748+ this . meta . getTags ( `name="${ name } "` ) . forEach ( ( tag ) => {
749+ this . meta . removeTagElement ( tag ) ;
750+ } ) ;
750751 }
751752 this . store . dispatch ( new ClearMetaTagAction ( ) ) ;
752753 } ) ;
0 commit comments