strip null values from JSON-LD hash
This commit is contained in:
		
							parent
							
								
									ca1200b90f
								
							
						
					
					
						commit
						da96f4d707
					
				|  | @ -73,6 +73,10 @@ module Jekyll | |||
|       alias_method :mainEntityOfPage, :main_entity | ||||
|       private :main_entity | ||||
| 
 | ||||
|       def to_json | ||||
|         to_h.reject { |_k, v| v.nil? }.to_json | ||||
|       end | ||||
| 
 | ||||
|       private | ||||
| 
 | ||||
|       attr_reader :page_drop | ||||
|  |  | |||
|  | @ -157,7 +157,7 @@ RSpec.describe Jekyll::SeoTag::JSONLDDrop do | |||
|     let(:metadata) { {} } | ||||
| 
 | ||||
|     it "does not return null values as json" do | ||||
|       expect(subject.to_json).to_not match(/:null/) | ||||
|       expect(subject.to_json).to_not match(%r!:null!) | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
|  | @ -340,7 +340,7 @@ EOS | |||
|       end | ||||
| 
 | ||||
|       it "removes null values from JSON-LD" do | ||||
|         expect(output).to_not match(/:null/) | ||||
|         expect(output).to_not match(%r!:null!) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue