You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that there is author field in the post object for blog, however it does not get displayed and I don't see any reference to it in the templates
export interface Post {
/** A unique ID number that identifies a post. */
id: string;
/** A post’s unique slug – part of the post’s URL based on its name, i.e. a post called “My Sample Page” has a slug “my-sample-page”. */
slug: string;
/** */
permalink: string;
/** */
publishDate: Date;
/** */
updateDate?: Date;
/** */
title: string;
/** Optional summary of post content. */
excerpt?: string;
/** */
image?: ImageMetadata | string;
/** */
category?: string;
/** */
tags?: Array<string>;
/** */
author?: string;
/** */
metadata?: MetaData;
/** */
draft?: boolean;
/** */
Content?: AstroComponentFactory;
content?: string;
/** */
readingTime?: number;
}
The text was updated successfully, but these errors were encountered:
Hey, check the file ListItem.astro, if you add console.log to log the post you can see that the author prop is there but the author is undefined.
const{ post }=Astro.props;console.log(post);
Add an author prop to the frontmatter of any of the posts and you will see it in the logs.
publishDate: 2023-08-09T00:00:00Z
title: Useful tools and resources to create a professional website
...
author: Author Name
...
tags:
- front-end
- tools
- resources
you can render the author adding something like this to the html in the ListItem.astro file
<div>Author: {post.author}</div>
thkruz
added a commit
to thkruz/astrowind
that referenced
this issue
Jan 14, 2024
Hey,
I see that there is author field in the post object for blog, however it does not get displayed and I don't see any reference to it in the templates
The text was updated successfully, but these errors were encountered: