Skip to content

Commit e443051

Browse files
authored
Merge pull request #51 from CodeandoMexico/feat/authors
removed console.log and account for not authors
2 parents 636fbe1 + 45a0eaf commit e443051

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/routes/aviso-de-privacidad/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
const date_updated = processDate(aviso.date_updated)
55
function processDate(dateObject, locale) {
66
locale ??= 'es-mx'
7-
console.log(locale)
87
let formattedDate = new Date(dateObject)
98
let finalDate = formattedDate.toLocaleString(locale, { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' })
109
return finalDate

src/routes/blog/[slug]/+page.svelte

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515

1616
<div class="container m-auto p-3 prose">
1717
<h1 class="text-center font-bold">{post.title}</h1>
18-
<p class="text-center">Por
19-
{#each post.authors as author, i }
20-
<span>{author.authors_id.name || ''}{#if i < (post.authors.length-1)}, {/if}</span>
21-
{/each}
22-
</p>
18+
{#if post.authors}
19+
<p class="text-center">Por
20+
{#each post.authors as author, i }
21+
<span>{author.authors_id.name || ''}{#if i < (post.authors.length-1)}, {/if}</span>
22+
{/each}
23+
</p>
24+
{/if}
2325
<p class="text-center text-sm text-gray-400">{new Date(post.date_created).toLocaleString('es-MX')}</p>
2426
</div>
2527
<img src={`https://content.codeandomexico.org/assets/${post.post_image}`} alt="Imagen de blog" class="w-full max-h-[450px] object-cover" />

0 commit comments

Comments
 (0)