Skip to content

Commit 72e89da

Browse files
updating jobs categories parse
1 parent 302aff9 commit 72e89da

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/components/jobs/jobCard.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import jobsCategories from "../../data/jobsCategories.json";
44
import JobCardCategory from "./jobCardCategory.astro";
55
66
const { job } = Astro.props;
7-
const job_categories = (job.categories ?? "") .split(",") .map(x => x.trim()) .filter(Boolean);
87
const jobUrl = `/empleos/${job.pubDate}/${job.slug}`;
98
109
const locationLabel = job.location ? job.location : "Presencial";
@@ -52,7 +51,7 @@ const locationLabel = job.location ? job.location : "Presencial";
5251
)
5352
}
5453
{
55-
job.parttime && (
54+
job.parttime != null && (
5655
<>
5756
<JobCardCategory text={jobsCategories["parttime"].text} ico="part-time" url={jobsCategories["parttime"].slug} />
5857
<div class="w-0.5 h-5 mr-1 bg-gray-400 place-self-center hidden md:block" />
@@ -84,7 +83,7 @@ const locationLabel = job.location ? job.location : "Presencial";
8483
)
8584
}
8685
{
87-
job_categories.map((category) => (
86+
job.categories.map((category) => (
8887
<>
8988
<a
9089
href={"/empleos/" + profileCategories[category].slug}

src/components/jobs/jobHeader.astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const { job } = Astro.props;
1111
1212
const display_date = dayjs(job.pubDate).format("DD/MM/YY");
1313
14-
const job_categories = (job.categories ?? "") .split(",") .map(x => x.trim()) .filter(Boolean);
15-
1614
if (
1715
job.organizationWebsite &&
1816
!job.organizationWebsite.includes("https://") &&
@@ -161,7 +159,7 @@ if (
161159

162160
<div class="flex flex-wrap justify-center md:justify-start">
163161
{
164-
job_categories.map((category) => (
162+
job.categories.map((category) => (
165163
<a
166164
href={"/empleos/" + profileCategories[category].slug}
167165
class="inline my-1 rounded-md hover:bg-gray-100 bg-gray-50 text-gray-800 dark:hover:bg-gray-600 dark:bg-gray-700 dark:text-gray-100 font-normal text-sm py-1 px-2 mr-3 "

src/pages/empleos/[...slug].astro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,9 @@ if (job.freelance) {
7272
jobType = "Freelance";
7373
}
7474
75-
const job_categories = (job.categories ?? "")
76-
.split(",")
77-
.map((x) => x.trim())
78-
.filter(Boolean);
7975
let jobTitle = job.title;
80-
if (job_categories.length > 0) {
81-
jobTitle = job_categories.map((category) => profileCategories[category].text).join(", ");
76+
if (job.categories.length > 0) {
77+
jobTitle = job.categories.map((category) => profileCategories[category].text).join(", ");
8278
if (jobType) {
8379
jobTitle = jobType + " " + jobTitle;
8480
}

0 commit comments

Comments
 (0)