Skip to content

Commit

Permalink
minor bug about product- richie identified and fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
darsan-in committed May 15, 2024
1 parent 9b70ef1 commit b75e860
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 57 deletions.
1 change: 1 addition & 0 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ export const richieGroupB: richies[] = [
"organization",
"event",
"product",
"productwv",
];

//(C) i-HTMLPath
Expand Down
42 changes: 21 additions & 21 deletions outputs/Test_courses.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"description": "This course serves as an introduction to Python programming, covering essential concepts and skills necessary for beginners to start coding in Python. Participants will learn about basic syntax, data types, control flow structures, functions, and file handling. Additionally, the course will cover key Python libraries and modules for common tasks such as data manipulation, visualization, and working with external files. Throughout the course, hands-on exercises and projects will reinforce learning objectives, allowing participants to apply their newfound knowledge to real-world scenarios.",
"provider": {
"@type": "Organization",
"name": "cresteem",
"sameAs": "https://cresteem.com/"
"name": "LMS",
"sameAs": "https://lms.com/"
},
"offers": {
"@type": "Offer",
Expand All @@ -26,7 +26,7 @@
"hasCourseInstance": {
"@type": "CourseInstance",
"courseMode": "online",
"instructor": { "@type": "Person", "name": "InstructorX" },
"instructor": { "@type": "Person", "name": "Saravanan" },
"inLanguage": ["English"],
"courseSchedule": {
"@type": "Schedule",
Expand All @@ -44,8 +44,8 @@
"description": "This course provides a comprehensive introduction to Node.js, a popular runtime environment for executing JavaScript code server-side. Participants will learn how to build scalable, high-performance web applications using Node.js, leveraging its asynchronous, event-driven architecture. The course covers essential concepts such as event loops, modules, package management, and asynchronous programming patterns. Additionally, participants will explore key Node.js frameworks and libraries for web development, including Express.js for building web servers and handling HTTP requests. Hands-on exercises and projects will reinforce learning objectives, allowing participants to apply their knowledge to real-world scenarios.",
"provider": {
"@type": "Organization",
"name": "edureka",
"sameAs": "https://edureka.com/"
"name": "Edutube",
"sameAs": "https://edutube.com/"
},
"offers": {
"@type": "Offer",
Expand All @@ -56,7 +56,7 @@
"hasCourseInstance": {
"@type": "CourseInstance",
"courseMode": "onsite",
"instructor": { "@type": "Person", "name": "InstructorZ" },
"instructor": { "@type": "Person", "name": "Ram" },
"inLanguage": ["Tamil", "French"],
"courseSchedule": {
"@type": "Schedule",
Expand All @@ -74,8 +74,8 @@
"description": "This course offers a comprehensive introduction to Java programming, covering core concepts and principles essential for beginners to embark on their journey in Java development. Participants will learn about Java syntax, object-oriented programming (OOP), control flow structures, exception handling, and input/output operations. Additionally, the course will cover key Java libraries and frameworks, providing a solid foundation for developing robust, scalable applications. Hands-on exercises and projects will reinforce learning objectives, enabling participants to apply their knowledge to practical scenarios.",
"provider": {
"@type": "Organization",
"name": "oracle",
"sameAs": "https://oracle.com/"
"name": "Notoracle",
"sameAs": "https://notoracle.com/"
},
"offers": {
"@type": "Offer",
Expand All @@ -86,7 +86,7 @@
"hasCourseInstance": {
"@type": "CourseInstance",
"courseMode": "blended",
"instructor": { "@type": "Person", "name": "Meg" },
"instructor": { "@type": "Person", "name": "Peter" },
"inLanguage": ["Tamil", "English", "Hindi"],
"courseSchedule": {
"@type": "Schedule",
Expand All @@ -109,10 +109,10 @@

<!-- instructor name -->
<!-- "By<space>Instructor" can be added or straight forward name in instructor inner text-->
<p class="rjs-course-1-ins">By InstructorX</p>
<p class="rjs-course-1-ins">By Saravanan</p>

<!-- mode of course online|onsite|blended- Case insensitive-->
<p class="rjs-course-1-mode">online</p>
<p class="rjs-course-1-mode">Online</p>

<!-- description -->
<p class="rjs-course-1-desc">
Expand All @@ -137,8 +137,8 @@
<p class="rjs-course-1-cost" data-currency="usd">100 USD</p>

<!-- publisher url with publisher name as innnertext -->
<a class="rjs-course-1-purl" href="https://cresteem.com/">
<p>cresteem</p>
<a class="rjs-course-1-purl" href="https://lms.com/">
<p>LMS</p>
</a>
<!-- OR
publisher url with publisher name as element with id able class name
Expand All @@ -156,10 +156,10 @@

<!-- instructor name -->
<!-- "By<space>Instructor" can be added or straight forward name in instructor inner text-->
<p class="rjs-course-2-ins">By InstructorZ</p>
<p class="rjs-course-2-ins">By Ram</p>

<!-- mode of course online|onsite|blended - Case insensitive-->
<p class="rjs-course-2-mode">onsite</p>
<p class="rjs-course-2-mode">Onsite</p>

<!-- description -->
<p class="rjs-course-2-desc">
Expand All @@ -186,8 +186,8 @@
<p class="rjs-course-2-cost" data-currency="usd">2000 USD</p>

<!-- publisher url with publisher name as innnertext -->
<a class="rjs-course-2-purl" href="https://edureka.com/">
<p class="pname">edureka</p>
<a class="rjs-course-2-purl" href="https://edutube.com/">
<p class="pname">Edutube</p>
</a>
</div>

Expand All @@ -204,10 +204,10 @@

<!-- instructor name -->
<!-- "By<space>Instructor" can be added or straight forward name in instructor inner text-->
<p class="rjs-course-3-ins">Meg</p>
<p class="rjs-course-3-ins">Peter</p>

<!-- mode of course online|onsite|blended - Case insensitive-->
<p class="rjs-course-3-mode">blended</p>
<p class="rjs-course-3-mode">Blended</p>

<!-- description -->
<p class="rjs-course-3-desc">
Expand All @@ -233,8 +233,8 @@
<p class="rjs-course-3-cost" data-currency="inr">2000 RS</p>

<!-- publisher url with publisher name as innnertext -->
<a class="rjs-course-3-purl" href="https://oracle.com/">
<p class="pname">oracle</p>
<a class="rjs-course-3-purl" href="https://notoracle.com/">
<p class="pname">Notoracle</p>
</a>
</div>
</main>
Expand Down
12 changes: 6 additions & 6 deletions outputs/Test_localbusiness.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"longitude": 77.5978368737318
},
"url": "https://www.cresteem.com/test-sample/localbusiness#rjs-lb-1",
"telephone": "+91-8425937243",
"priceRange": "$200 - $500",
"telephone": "+91-84259372x3",
"priceRange": "INR 200 - INR 500",
"openingHoursSpecification": [
{
"@type": "OpeningHoursSpecification",
Expand Down Expand Up @@ -133,7 +133,7 @@
"longitude": -73.9983076246472
},
"url": "https://www.cresteem.com/test-sample/localbusiness#rjs-lb-2",
"telephone": "+1 212-380-8060",
"telephone": "+1 212-380-8x60",
"priceRange": "$100 - $1200",
"openingHoursSpecification": [
{
Expand Down Expand Up @@ -258,14 +258,14 @@

<!-- telephone -->
<!-- data-reservation="true" for reservation accepted (Boolean)-->
<p class="rjs-lb-1-tel" data-reserve="true">+91-8425937243</p>
<p class="rjs-lb-1-tel" data-reserve="true">+91-84259372x3</p>

<!-- serv cuisine - can be more than 1-->
<p class="rjs-lb-1-csnt">Asian</p>
<p class="rjs-lb-1-csnt">Mexican</p>

<!-- cost range -->
<p class="rjs-lb-1-cost">$200 - $500</p>
<p class="rjs-lb-1-cost">INR 200 - INR 500</p>

<!-- opening hour specification -->
<section class="rjs-lb-1-workhours">
Expand Down Expand Up @@ -402,7 +402,7 @@

<!-- telephone -->
<!-- data-reservation="true" for reservation accepted (Boolean)-->
<p class="rjs-lb-2-tel" data-reserve="false">+1 212-380-8060</p>
<p class="rjs-lb-2-tel" data-reserve="false">+1 212-380-8x60</p>

<!-- cost range -->
<p class="rjs-lb-2-cost">$100 - $1200</p>
Expand Down
52 changes: 26 additions & 26 deletions outputs/Test_org.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Cresteem",
"logo": "https://www.cresteem.com/img/logo.webp",
"name": "VideoLANO",
"logo": "https://www.videolano.com/img/logo.webp",
"image": [
"https://t3.ftcdn.net/jpg/06/31/36/22/360_F_631362231_5VR8Eo0R8VEflgSIfl0RgQvzyW194T5c.jpg",
"https://t3.ftcdn.net/jpg/06/31/36/22/360_F_631362231_5VR8Eo0R8VEflgSIfl0RgQvzyW194T5c.jpg",
"https://t3.ftcdn.net/jpg/06/31/36/22/360_F_631362231_5VR8Eo0R8VEflgSIfl0RgQvzyW194T5c.jpg"
],
"url": "https://www.cresteem.com/test-sample/org",
"sameAs": [
"https://www.instagram.com/iamspdarsan/",
"https://www.linkedin.com/in/iamspdarsan/",
"https://www.youtube.com/channel"
"https://www.instagram.com/videolano/",
"https://www.linkedin.com/in/videolano/",
"https://www.youtube.com/channel/videolano/"
],
"description": "We are a premier software company, offering top-notch web, mobile, and desktop development, SEO, digital marketing, UI/UX, and software solutions. With advanced AI integration, we deliver excellence on time, creatively, and affordably.",
"email": "yourmail@domain.com",
"telephone": "+91-8425937253",
"email": "hello@videolano.com",
"telephone": "+91-8425937x53",
"address": {
"@type": "PostalAddress",
"streetAddress": "90, MGR Nagar Street, Public Office Road",
Expand All @@ -42,9 +42,9 @@
"name": "Joogle",
"logo": "https://www.joogle.com/img/logo.webp",
"image": [
"https://www.example.com/1.jpg",
"https://www.example.com/2.jpg",
"https://www.example.com/3.jpg"
"https://www.joogle.com/1.jpg",
"https://www.joogle.com/2.jpg",
"https://www.joogle.com/3.jpg"
],
"url": "https://www.cresteem.com/test-sample/org",
"sameAs": [
Expand All @@ -53,8 +53,8 @@
"https://www.youtube.com/channel/joogle"
],
"description": "Joogle Web Design located in the Northern Suburbs is one of Perth's most affordable web design company's",
"email": "yourmail@joogle.com",
"telephone": "09873372530",
"email": "hello@joogle.com",
"telephone": "098733x2530",
"address": {
"@type": "PostalAddress",
"streetAddress": "10,XYZ Street",
Expand All @@ -75,12 +75,12 @@
<!-- organisation instance 1 -->
<div id="org1">
<!-- name -->
<p class="rjs-org-1-name">Cresteem</p>
<p class="rjs-org-1-name">VideoLANO</p>

<!-- logo -->
<img
class="rjs-org-1-logo"
src="https://www.cresteem.com/img/logo.webp"
src="https://www.videolano.com/img/logo.webp"
alt=""
/>

Expand Down Expand Up @@ -126,21 +126,21 @@
</div>

<!-- telephone -->
<p class="rjs-org-1-tel">+91-8425937253</p>
<p class="rjs-org-1-tel">+91-8425937x53</p>

<!-- social media links -->
<section>
<a
href="https://www.instagram.com/iamspdarsan/"
class="rjs-org-1-rlink"
<a href="https://www.instagram.com/videolano/" class="rjs-org-1-rlink"
>Instagram</a
>
<a
href="https://www.linkedin.com/in/iamspdarsan/"
href="https://www.linkedin.com/in/videolano/"
class="rjs-org-1-rlink"
>LinkedIN</a
>
<a href="https://www.youtube.com/channel" class="rjs-org-1-rlink"
<a
href="https://www.youtube.com/channel/videolano/"
class="rjs-org-1-rlink"
>Youtube</a
>
</section>
Expand All @@ -152,7 +152,7 @@
deliver excellence on time, creatively, and affordably.
</p>

<p class="rjs-org-1-email">yourmail@domain.com</p>
<p class="rjs-org-1-email">hello@videolano.com</p>

<p class="rjs-org-1-tid">IN8E679878</p>

Expand All @@ -176,17 +176,17 @@
<div>
<img
class="rjs-org-2-img"
src="https://www.example.com/1.jpg"
src="https://www.joogle.com/1.jpg"
alt="picture of reception"
/>
<img
class="rjs-org-2-img"
src="https://www.example.com/2.jpg"
src="https://www.joogle.com/2.jpg"
alt="another 1"
/>
<img
class="rjs-org-2-img"
src="https://www.example.com/3.jpg"
src="https://www.joogle.com/3.jpg"
alt="another 1"
/>
</div>
Expand All @@ -211,7 +211,7 @@
</div>

<!-- telephone -->
<p class="rjs-org-2-tel">09873372530</p>
<p class="rjs-org-2-tel">098733x2530</p>

<!-- social media links -->
<section>
Expand All @@ -233,7 +233,7 @@
most affordable web design company's
</p>

<p class="rjs-org-2-email">yourmail@joogle.com</p>
<p class="rjs-org-2-email">hello@joogle.com</p>

<p class="rjs-org-2-tid">IN9079875C</p>

Expand Down
2 changes: 1 addition & 1 deletion outputs/Test_productCombined.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"description": "Product Description Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"url": "https://www.cresteem.com/test-sample/productVarient/productCombined",
"brand": { "@type": "Brand", "name": "XYZ Brand" },
"productGroupID": "fa6d09d09f12fd4346e8333b0c06ab71",
"productGroupID": "571d91a36915c1676b395845f265e733",
"variesBy": ["color", "suggestedAge", "suggestedGender"],
"hasVariant": [
{
Expand Down
14 changes: 11 additions & 3 deletions richie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,15 @@ export async function richie(
const serializer: Function = functionMap[richieName].serializer;

const aggregatedData = await aggregator(...aggregatorParams);
const serializedData = serializer(aggregatedData);

const serializerParams: any[] =
richieName === "productwv" ?
[...Object.values(aggregatedData)] // [productMeta,variesBy]
: richieName === "product" ?
[Object.values(aggregatedData)[0]] // [productMeta]
: [aggregatedData];

const serializedData = serializer(...serializerParams);
const richResultSnippet = createJsonLD(serializedData);

writeOutput(source, destinationFile, richResultSnippet)
Expand All @@ -158,8 +166,8 @@ export async function richie(
}

export async function testRichie(): Promise<void> {
const richieName: richies = "article";
const filepath = "test-sample/article.html";
const richieName: richies = "organization";
const filepath = "test-sample/org.html";
const destinationFile = "./outputs/" + "Test_" + basename(filepath);

await richie(richieName, filepath, destinationFile);
Expand Down

0 comments on commit b75e860

Please sign in to comment.