feat: Home link
This commit is contained in:
parent
4c07beca9a
commit
fc1818b915
3 changed files with 3 additions and 9 deletions
|
@ -62,13 +62,7 @@ const {postDivSelector, skipSave = false} = Astro.props;
|
|||
html.innerHTML = responseText;
|
||||
const newPost = html.querySelector('body')?.querySelector('#post');
|
||||
if (postDiv && newPost?.innerHTML) {
|
||||
const homeLink = document.createElement('a');
|
||||
homeLink.href = '/';
|
||||
homeLink.innerText = 'Home';
|
||||
postDiv.innerHTML = (newPost.innerHTML)
|
||||
const homeLinkWrapper = document.createElement('div');
|
||||
homeLinkWrapper.append(homeLink)
|
||||
postDiv.insertBefore(homeLinkWrapper, postDiv.firstChild);
|
||||
postDiv.innerHTML = newPost.innerHTML
|
||||
}
|
||||
}
|
||||
const item = document.createElement('li');
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
import { ArticleData } from "@extractus/article-extractor";
|
||||
export interface Props {
|
||||
article: ArticleData;
|
||||
isHome?: boolean;
|
||||
}
|
||||
|
||||
const { article, isHome = false } = Astro.props;
|
||||
const { article } = Astro.props;
|
||||
const datePublished =
|
||||
article?.published && new Date(article.published).toDateString();
|
||||
---
|
||||
|
|
|
@ -18,6 +18,7 @@ const { title } = Astro.props;
|
|||
<body>
|
||||
<slot />
|
||||
<div id="main-content">
|
||||
<a href="/">Home</a>
|
||||
<div id="post-wrapper">
|
||||
<slot name="post" />
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue