diff --git a/src/components/article.astro b/src/components/article.astro new file mode 100644 index 0000000..ff809e1 --- /dev/null +++ b/src/components/article.astro @@ -0,0 +1,14 @@ +--- +import { ArticleData } from "@extractus/article-extractor"; + +const article = Astro.props.article; + +export interface Props { + article: ArticleData; +} +--- + +
by {article.author}
+ + diff --git a/src/pages/index.astro b/src/pages/index.astro index cb8821b..65c634e 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,12 +1,13 @@ --- import Form, { FormGroup } from "@astro-reactive/form"; import { Validators } from "@astro-reactive/validator"; -import { extract } from "@extractus/article-extractor"; import getParams from "../utils/get-params"; +import { extract } from "@extractus/article-extractor"; +import Article from "../components/article.astro"; const params = getParams(Astro.url); const url = params?.url; -const article = extract(url); +const article = await extract(url); const form = new FormGroup([ { @@ -29,4 +30,4 @@ const form = new FormGroup([ }} /> -{article ?{JSON.stringify(article)}
: "