Schema items that are not in Jobs > Attributes

Under HivePress>Settings>Jobs I’ve selected JobPosting as the Schema Type for the SEO plug in.

In Jobs>Attributes I’ve set an attribute called Salary to the schema item baseSalary. This works correctly.

In Jobs>Attributes I’ve set an attribute called Type to the schema item employmentType. This works correctly.

Unfortunately there are four critical schema items that are not in Jobs>Attributes (therefore I’m unable to manually set them) that are failing the Google Rich Results Test for JobPosting:

‘hiringOrganization’
‘title’
‘jobLocation’
‘datePosted’

All four of the above pieces of information exist but are not being mapped correctly.

I’d also like to be able to set the job expiry date to:

‘validThrough’

Please can you help so I can get my jobs submitted correctly as per JobPosting schema.

Hi,

Please provide more details, do you mean our extension? That is, there are no available attributes in the list to select so that you can map them?

Yes, your extension.

I have selected JobPosting schema in HivePress>Settings>Jobs.

JobPosting Schema requires the following four values to be valid, without them the job listing is rejected. The values are named as per the Schema’s requirement.

'hiringOrganization’
‘title’
‘jobLocation’
‘datePosted’

JobHive does not automatically map these values from JobHive to these four JobPosting values/properties. This means they are blank hence the missing field error message in the rich results test results.

For example:

The job posting title in JobHive should be mapped to the Schema value ‘title’.

JobHive doesn’t do this automatically - it should as these are required values and your plug in has JobPosting as a supported schema.

However the HivePress SEO plug-in does allow the user to map attributes (Jobs > Attributes) to the schema values. As an example I have created an Salary attribute in Jobs and have mapped it to the schema property ‘baseSalary’

This works correctly.

I have also successfully mapped my Type attribute to the ‘employmentType’ property:

However none of the four values listed above are accessible to me the user as an attribute. They are baked into JobHive somewhere. There is no way for me to manually map them correctly.

I need to know how to map these four values that exist in JobHive to the JobPosting schema:

  • The listing title to ‘title’
  • The vendor name to 'hiringOrganization’
  • The listing location to ‘jobLocation’
  • The listing publication date to ‘datePosted’

using your SEO plug in.

Thank you.

Hi,

I see. Thanks for reporting this, we’ll fix it as soon as possible. I will send the request to our developer and he will provide you with a temporary solution later.

Thanks Andrii - look forward to the workaround.

Has the developer got a temporary workaround for me?

Sorry for the delay. Please try this code snippet as a temporary fix:

add_filter(
	'hivepress/v1/models/listing/schema',
	function( $schema ) {
		$listing = hivepress()->request->get_context( 'listing' );

		if ( ! $listing ) {
			return $schema;
		}

		$schema['title']              = $listing->get_title();
		$schema['hiringOrganization'] = $listing->get_vendor__name();
		$schema['jobLocation']        = $listing->get_location();
		$schema['datePosted']         = $listing->get_created_date();

		return $schema;
	}
);

Thank you @ihor

It’s still returning one critical error after I’ve added your code snippet.

It looks like it’s not adding my location value to the “address” parameter inside “jobLocation”.

This is an example of the correct structure from the Google help page:

There are two other recommended JobPosting fields that I’d like to pull through as well. Is it possible for you to update the snippet to target these:

  1. the vendor name (edit - IGNORE this is done already sorry).

  2. the vendor image

and link them to these properties:

There is also a validThrough property for the expiry date of the job - can these be targeted as well?

CleanShot 2023-12-12 at 11.54.07@2x

Thanks again for your help.

Hi guys, friendly chase on this one - as a reminder it’s still failing to satisfy the jobPosting criteria.

Thanks for your patience. Please check if the “address” property accepts a string because HivePress stores the location text, breaking it into the address components would require further customizations. You can try this code snippet instead to add other schema properties you mentioned:

add_filter(
	'hivepress/v1/models/listing/schema',
	function( $schema ) {
		$listing = hivepress()->request->get_context( 'listing' );

		if ( ! $listing ) {
			return $schema;
		}

		$schema['title'] = $listing->get_title();

		$schema['jobLocation'] = $listing->get_location();
		$schema['datePosted']  = $listing->get_created_date();

		if ( $listing->get_expired_time() ) {
			$schema['validThrough'] = date( 'Y-m-d H:i:s', $listing->get_expired_time() );
		}

		$image = $listing->get_vendor__image();

		if ( $image ) {
			$image = $image->get_url( 'thumbnail' );
		}

		$schema['hiringOrganization'] = [
			'name' => $listing->get_vendor__name(),
			'logo' => $image,
		];

		return $schema;
	}
);

Thanks Ihor.

Unfortunately we’ve gone a step backwards now and it doesn’t recognise any of it as being of a schema type.

I’ve separately emailed you the code from the Google Rich Results page.

Please make sure that it’s added correctly, when I test it locally this Schema is generated in the source code:

{
    "@context": "https://schema.org",
    "@type": "JobPosting",
    "name": "Stylish remodeled room",
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae eleifend massa. Sed tristique vehicula urna, et scelerisque orci suscipit nec. Donec egestas id nulla at lacinia. Donec lorem lectus, suscipit ac mi id, blandit posuere enim. Quisque mollis erat fermentum risus auctor fermentum curabitur quis aliquet dui. Integer enim nisl, sollicitudin sed dui et, luctus egestas magna.",
    "address": "211 Brown Pl, Bronx, NY",
    "latitude": "40.80744",
    "longitude": "-73.920598",
    "hasMap": "https://www.google.com/maps/search/?api=1&query=40.80744,-73.920598",
    "title": "Stylish remodeled room",
    "jobLocation": "",
    "datePosted": "2021-11-17 16:40:45",
    "hiringOrganization": {
        "name": "admin",
        "logo": "http://dev.local/wp-content/uploads/2023/12/71sXyIwFvBL._AC_SL1000_-150x150.jpg"
    }
}

Deactivated Rank Math and tried again and it’s pulling through now - however the address field is still returning invalid as before.

This one field invalidates the whole schema.

Here are the results of my test: https://search.google.com/test/rich-results/result?id=r4t0p0Toqabzgyoxkc4L_Q

Based on the guidelines from Google: Obtén información sobre el lenguaje de marcado Schema de publicaciones de empleos | Central de la Búsqueda de Google  |  Documentation  |  Google for Developers

It looks like your get_location() function needs to then split its return values into the various different properties(“streetAddress” etc) that come under the jobLocation field.

Based on experience of doing this manually there’s no checking from google that the “streetAddress” etc is actually a street address, just that it contains a string in there. So it doesn’t matter what parts of the location strings go where (perhaps the first part of the location goes into the first field “streetAddress”, second into “addressLocality” and so on but the last string in the location always has to go in the “addressCountry” field as this field has to contain a string otherwise it fails.

Really appreciate your help on this one - if you can get this last bit working I’ve got no need to use a third party for this and I’ll purchase your SEO plug in for my other two sites with you.

Yes, as noted above it would be hard to break the location text into the structured address, the snippet I provided doesn’t include it (job location is set as a text). Please check in the Schema specs if it’s possible to set jobLocation with an array of details where address is just a text, then I can provide another snippet.

Sorry Ihor I don’t understand how to get the answer to " Please check in the Schema specs if it’s possible to set jobLocation with an array of details where address is just a text"

I think the detail in the specs is here:

There’s also the Google specific specs here: Learn About Job Posting Schema Markup | Google Search Central  |  Documentation  |  Google for Developers

But I don’t understand enough about the question to be able to answer it for you.

I’m happy to test a new snippet if you update with it whatever you’re proposing.

EDIT:

The following code passes the test but it’s not putting the address on the correct lines:


add_filter(
	'hivepress/v1/models/listing/schema',
	function( $schema ) {
		$listing = hivepress()->request->get_context( 'listing' );

		if ( ! $listing ) {
			return $schema;
		}

		$schema['title'] = $listing->get_title();
//my change is here
		$schema['jobLocation'] = [
			'address' => $listing->get_location()];
		
		
		$schema['datePosted']  = $listing->get_created_date();

		if ( $listing->get_expired_time() ) {
			$schema['validThrough'] = date( 'Y-m-d H:i:s', $listing->get_expired_time() );
		}

		$image = $listing->get_vendor__image();

		if ( $image ) {
			$image = $image->get_url( 'thumbnail' );
		}

		$schema['hiringOrganization'] = [
			'name' => $listing->get_vendor__name(),
			'logo' => $image,
		];

		return $schema;
	}
);

To add to this, as soon as I turn Rank Math Pro back on (with their Structured Data component turned off) your SEO plugin stops working.

This is the result I get back the moment I turn Rank math back on (with no other changes, immediately before this the rich results test is returning correctly):

https://search.google.com/test/rich-results/result?id=kws_DaguzJY4etX42Tynew

There seems to be a clash between the two plug ins - any suggestions for me?

Please try enabling their Schema component because when Rank Math is enabled our Schema appears via their API to avoid conflicts. The code snippet you posted should be ok, it sets jobLocation as an array with the address parameter as text, does it trigger any errors?

Your Rank Math fix worked thank you.

My code snippet puts the full address into:

jobLocation
name

but I still get missing field errors for the properties under:

jobLocation
address

However the overall schema gets validated as jobPosting.

I’ll wait to see where the address is actually displayed for the users once Google has indexed the pages and attributed them as rich results.

I’d like to use this on my other sites now - when will you update your SEO plug in to support jobPosting without this workaround?

Yes, at the moment there’s no easy way to break the address into these components for the Schema, we’ll try to update both SEO and Geolocation to support this. Currently there’s no ETA, but we plan to release a roadmap with predictable ETAs soon.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.