Back to Schema Markup Support

info62820
info62820

Hello,

When a schema has two sub-template, plugin cant display it.

For example:

for this Yaml:

_type: SoftwareApplication
name: "My software"
operatingSystem: "Linux"
applicationCategory: "FinanceApplication"
offers:
    _type: "Offer"
    price: "300.99"
    priceCurrency: "USD"
aggregateRating:
    _type: "AggregateRating"
    ratingValue: "4.5"
    ratingCount: "100"

It produces:

<script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"My software","operatingSystem":"Linux","applicationCategory":"FinanceApplication","offers":{"_type":"Offer","price":"300.99","priceCurrency":"USD"},"_type":"AggregateRating","ratingValue":"4.5","ratingCount":"100"}</script>

Notice the aggregateRating sub-template is not in the proper format,

I also tried to include them with &SubTemplate style, it also gave a similar result.

Linkonoid
Linkonoid

Hello,

You need to set each template in a separate template description (test https://testv2.linkonoid.com/schema-markup):

_type: "Offer"
price: "300.99"
priceCurrency: "USD"
_type: "AggregateRating"
ratingValue: "4.5"
ratingCount: "100"
_type: SoftwareApplication
name: My software
operatingSystem: Linux
applicationCategory: FinanceApplication
offers: '&Offer'
aggregateRatings: '&AggregateRating'

This was done not by accident, but for the purpose of further reuse of template blocks. Be sure to pay attention to the "& TemplateName" - the special character & is used, so be sure to in quotes. In case "aggregateRating(!): '&AggregateRating'", if a variable matches a template name, rendering will occur without creating an object:

"offers":{"price":"300.99","priceCurrency":"USD"},"ratingValue":"4.5","ratingCount":"100"

Schemes can also be created manually in the "/schemas" folder of the plugin (or by the specified path in the plugin settings) with the obligatory installation of the "TemplateName.yaml" file extension, this template should be auto added to the list of templates in the settings.

Last updated

info62820
info62820

Hello,

I tried this first but it gives the wrong output. In your example you used aggregateRatings: '&AggregateRating', can you try with aggregateRating: '&AggregateRating'?

Weird but, it works with aggregateRatings but not aggregateRating as field name. True field name is aggregateRating

info62820
info62820

Sorry I just noticed, you already mentioned that if variable name matches template name, it will should without object. In my current case, variable matches the template name and it shows without object. In this case what should I do?

info62820
info62820

Hello,

Do you plan to update the plugin to fix this issue or should I look for another solution?

Thanks

Linkonoid
Linkonoid

Plugin update to v 1.0.5 Demo

Last updated

info62820
info62820

Hey, thanks for the update. Sorry for the bad review, I didn't know I can't edit or remove it.

The update doesn't show up on the plugin page also in October UI, how to update?

1-7 of 7