@studiocms/blog 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/blog.d.js +0 -0
- package/dist/blog.d.ts +8 -0
- package/dist/components/BaseHead.astro +73 -0
- package/dist/components/Footer.astro +26 -0
- package/dist/components/Navigation.astro +83 -0
- package/dist/components/PageList.astro +46 -0
- package/dist/components/PostHeader.astro +24 -0
- package/dist/components/RSSIcon.astro +6 -0
- package/dist/components/navigation.css +155 -0
- package/dist/components.d.js +0 -0
- package/dist/components.d.ts +13 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +81 -0
- package/dist/layouts/Layout.astro +60 -0
- package/dist/lib.d.js +0 -0
- package/dist/lib.d.ts +82 -0
- package/dist/renderer.d.js +0 -0
- package/dist/renderer.d.ts +9 -0
- package/dist/routes/[...slug].astro +36 -0
- package/dist/routes/blog/[...slug].astro +44 -0
- package/dist/routes/blog/index.astro +32 -0
- package/dist/routes/rss.xml.d.ts +2 -0
- package/dist/routes/rss.xml.js +34 -0
- package/dist/routes/rss.xml.ts +44 -0
- package/dist/routes/sitemap-md.xml.d.ts +2 -0
- package/dist/routes/sitemap-md.xml.js +22 -0
- package/dist/routes/sitemap-md.xml.ts +28 -0
- package/dist/routes/sitemap-posts.xml.d.ts +2 -0
- package/dist/routes/sitemap-posts.xml.js +30 -0
- package/dist/routes/sitemap-posts.xml.ts +38 -0
- package/dist/sdk.d.js +0 -0
- package/dist/sdk.d.ts +56 -0
- package/dist/styles/base.css +245 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.js +0 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 StudioCMS - Adam Matthiesen, Jacob Jenkins, Paul Valladares
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# StudioCMS - Blog Provider
|
package/dist/blog.d.js
ADDED
|
File without changes
|
package/dist/blog.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '../styles/base.css';
|
|
3
|
+
import config from 'studiocms:config';
|
|
4
|
+
import {
|
|
5
|
+
type HeadConfig,
|
|
6
|
+
type HeadConfigSchema,
|
|
7
|
+
type HeadUserConfig,
|
|
8
|
+
createHead,
|
|
9
|
+
headDefaults,
|
|
10
|
+
} from 'studiocms:lib';
|
|
11
|
+
import type { z } from 'astro/zod';
|
|
12
|
+
|
|
13
|
+
let htmlDefaultHead: HeadUserConfig = [];
|
|
14
|
+
let favicon = '';
|
|
15
|
+
|
|
16
|
+
if (config.defaultFrontEndConfig && typeof config.defaultFrontEndConfig === 'object') {
|
|
17
|
+
if (config.defaultFrontEndConfig.htmlDefaultHead) {
|
|
18
|
+
htmlDefaultHead.push(...config.defaultFrontEndConfig.htmlDefaultHead);
|
|
19
|
+
}
|
|
20
|
+
if (config.defaultFrontEndConfig.favicon) {
|
|
21
|
+
favicon = config.defaultFrontEndConfig.favicon;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
lang?: string | undefined;
|
|
29
|
+
image?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const canonicalURL = Astro.url;
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
lang = 'en',
|
|
38
|
+
image = 'https://images.unsplash.com/photo-1707343843982-f8275f3994c5?q=80&w=1032&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
39
|
+
} = Astro.props;
|
|
40
|
+
|
|
41
|
+
const makeHeader = headDefaults(title, description, lang, Astro, favicon, image, canonicalURL);
|
|
42
|
+
|
|
43
|
+
const StudioCMSFrontEndHeads: z.input<ReturnType<typeof HeadConfigSchema>> = [
|
|
44
|
+
// Fonts
|
|
45
|
+
{ tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.googleapis.com' } },
|
|
46
|
+
{ tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' } },
|
|
47
|
+
{
|
|
48
|
+
tag: 'link',
|
|
49
|
+
attrs: {
|
|
50
|
+
href: 'https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap',
|
|
51
|
+
rel: 'stylesheet',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
makeHeader.push(...StudioCMSFrontEndHeads);
|
|
57
|
+
|
|
58
|
+
// TODO: Setup Sitemap integration
|
|
59
|
+
// Link to sitemap, but only when `site` is set.
|
|
60
|
+
// if (Astro.site) {
|
|
61
|
+
// makeHeader.push({
|
|
62
|
+
// tag: 'link',
|
|
63
|
+
// attrs: {
|
|
64
|
+
// rel: 'sitemap',
|
|
65
|
+
// href: fileWithBase('/sitemap-index.xml'),
|
|
66
|
+
// },
|
|
67
|
+
// });
|
|
68
|
+
// }
|
|
69
|
+
|
|
70
|
+
const head = createHead(makeHeader, htmlDefaultHead as HeadConfig);
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
{head.map(({ tag: Tag, attrs, content }) => <Tag {...attrs} set:html={content} />)}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
siteTitle: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { siteTitle } = Astro.props;
|
|
7
|
+
const today = new Date();
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<footer>
|
|
11
|
+
© <span id="footer-year">{today.getFullYear()}</span> {siteTitle}. All rights reserved.
|
|
12
|
+
</footer>
|
|
13
|
+
|
|
14
|
+
<script is:inline>
|
|
15
|
+
const footerYear = document.getElementById('footer-year');
|
|
16
|
+
footerYear.textContent = new Date().getFullYear();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
footer {
|
|
21
|
+
padding: 2em 1em 6em 1em;
|
|
22
|
+
background: linear-gradient(var(--gray-gradient)) no-repeat;
|
|
23
|
+
color: rgb(var(--gray));
|
|
24
|
+
text-align: center;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { StudioCMSRoutes } from 'studiocms:lib';
|
|
3
|
+
import './navigation.css';
|
|
4
|
+
import { frontendNavigation } from 'studiocms:plugin-helpers';
|
|
5
|
+
import studioCMS_SDK from 'studiocms:sdk/cache';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
topLevelLinkCount?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const { topLevelLinkCount = 3 } = Astro.props;
|
|
12
|
+
|
|
13
|
+
const config = (await studioCMS_SDK.GET.siteConfig()).data;
|
|
14
|
+
|
|
15
|
+
const { title } = config || { title: 'StudioCMS' };
|
|
16
|
+
const {
|
|
17
|
+
mainLinks: { baseSiteURL },
|
|
18
|
+
} = StudioCMSRoutes;
|
|
19
|
+
|
|
20
|
+
type LinkProps = {
|
|
21
|
+
text: string;
|
|
22
|
+
href: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const links: LinkProps[] = await frontendNavigation();
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<!-- If no dropdown items -->
|
|
29
|
+
{ ( links.length < topLevelLinkCount || links.length === topLevelLinkCount ) && (
|
|
30
|
+
<div class="navigation">
|
|
31
|
+
<div class="title"><a href={baseSiteURL}>{title}</a></div>
|
|
32
|
+
<div class="mini-nav">
|
|
33
|
+
<button>Menu</button>
|
|
34
|
+
<div class="mini-nav-content">
|
|
35
|
+
{
|
|
36
|
+
links.map(({ text, href }) => (
|
|
37
|
+
<a {href}>{text}</a>
|
|
38
|
+
))
|
|
39
|
+
}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
{
|
|
43
|
+
links.map(({ text, href }) => (
|
|
44
|
+
<a class="links" {href}>{text}</a>
|
|
45
|
+
))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
<a class="avatar" href={StudioCMSRoutes.authLinks.loginURL}>Dashboard</a>
|
|
49
|
+
</div>
|
|
50
|
+
) }
|
|
51
|
+
|
|
52
|
+
<!-- If dropdown items -->
|
|
53
|
+
{ links.length > topLevelLinkCount && (
|
|
54
|
+
<div class="navigation">
|
|
55
|
+
<div class="title"><a href={baseSiteURL}>{title}</a></div>
|
|
56
|
+
|
|
57
|
+
<div class="mini-nav">
|
|
58
|
+
<button>Menu</button>
|
|
59
|
+
<div class="mini-nav-content">
|
|
60
|
+
{
|
|
61
|
+
links.map(({ text, href }) => (
|
|
62
|
+
<a {href}>{text}</a>
|
|
63
|
+
))
|
|
64
|
+
}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
{
|
|
68
|
+
links.slice(0, topLevelLinkCount).map(({ text, href }) => (
|
|
69
|
+
<a class="links" {href}>{text}</a>
|
|
70
|
+
))
|
|
71
|
+
}
|
|
72
|
+
<div class="dropdown">
|
|
73
|
+
<button>More ▼</button>
|
|
74
|
+
<div class="dropdown-content">
|
|
75
|
+
{ links.slice(topLevelLinkCount).map(({ text, href }) => (
|
|
76
|
+
<a {href}>{text}</a>
|
|
77
|
+
)) }
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<a class="avatar" href={StudioCMSRoutes.authLinks.loginURL}>Dashboard</a>
|
|
82
|
+
</div>
|
|
83
|
+
) }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
import blogConfig from 'studiocms:blog/config';
|
|
3
|
+
import { FormattedDate } from 'studiocms:components';
|
|
4
|
+
import { CustomImage } from 'studiocms:imageHandler/components';
|
|
5
|
+
import { pathWithBase } from 'studiocms:lib';
|
|
6
|
+
import type { CombinedPageData } from 'studiocms:sdk/types';
|
|
7
|
+
|
|
8
|
+
const blogRouteFullPath = `${blogConfig.route}/[...slug]`;
|
|
9
|
+
|
|
10
|
+
function getBlogRoute(slug: string) {
|
|
11
|
+
if (blogRouteFullPath) {
|
|
12
|
+
return blogRouteFullPath.replace('[...slug]', slug);
|
|
13
|
+
}
|
|
14
|
+
return '#';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
blogPageList: CombinedPageData[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { blogPageList } = Astro.props;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<ul>
|
|
25
|
+
{
|
|
26
|
+
blogPageList.length > 0 && blogPageList.map(({slug, heroImage, title, description, publishedAt}) => (
|
|
27
|
+
<li>
|
|
28
|
+
<a href={pathWithBase(getBlogRoute(slug))}>
|
|
29
|
+
<CustomImage src={heroImage} alt={title} width={720} height={360}/>
|
|
30
|
+
<div>
|
|
31
|
+
<span class="title">{title}</span>
|
|
32
|
+
<span class="date"> <FormattedDate date={publishedAt} /> </span>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<p class="description">
|
|
36
|
+
{description}
|
|
37
|
+
</p>
|
|
38
|
+
</a>
|
|
39
|
+
</li>
|
|
40
|
+
))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
blogPageList.length === 0 && <li>No blog posts found</li>
|
|
45
|
+
}
|
|
46
|
+
</ul>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { FormattedDate } from 'studiocms:components';
|
|
3
|
+
import { CustomImage } from 'studiocms:imageHandler/components';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
title: string;
|
|
7
|
+
publishedAt: Date;
|
|
8
|
+
updatedAt?: Date | null;
|
|
9
|
+
heroImage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { title, description, heroImage, publishedAt, updatedAt } = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
<h1 class="title">{title}</h1>
|
|
16
|
+
|
|
17
|
+
<div style="text-align: center;">
|
|
18
|
+
<CustomImage src={heroImage} alt={title} width={720} height={360}/>
|
|
19
|
+
<div>
|
|
20
|
+
<p class="date">Published: <FormattedDate date={publishedAt}/></p>
|
|
21
|
+
{updatedAt && <p class="date"> | Last Updated: <FormattedDate date={updatedAt}/></p>}
|
|
22
|
+
</div>
|
|
23
|
+
<p class="description">{description}</p>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
const props = Astro.props;
|
|
3
|
+
---
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" {...props}>
|
|
5
|
+
<path fill="currentColor" d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19 7.38 20 6.18 20C5 20 4 19 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27zm0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93z" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
.navigation {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
gap: 20px;
|
|
5
|
+
height: 60px;
|
|
6
|
+
align-items: center;
|
|
7
|
+
background-color: hsl(0, 0%, 95%);
|
|
8
|
+
padding: 10px 20px;
|
|
9
|
+
box-shadow: 0 2px 5px hsla(0, 0%, 0%, 0.2);
|
|
10
|
+
}
|
|
11
|
+
.navigation .title {
|
|
12
|
+
font-size: xx-large;
|
|
13
|
+
color: black;
|
|
14
|
+
text-decoration: none;
|
|
15
|
+
position: absolute;
|
|
16
|
+
left: 20px;
|
|
17
|
+
}
|
|
18
|
+
.navigation .title a {
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
}
|
|
21
|
+
.navigation .mini-nav {
|
|
22
|
+
display: hidden;
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
}
|
|
25
|
+
.navigation .mini-nav button {
|
|
26
|
+
background-color: hsl(0, 0%, 95%);
|
|
27
|
+
color: back;
|
|
28
|
+
font-size: larger;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
border: none;
|
|
31
|
+
padding: 10px 15px;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
display: hidden;
|
|
34
|
+
visibility: hidden;
|
|
35
|
+
}
|
|
36
|
+
.navigation .mini-nav a {
|
|
37
|
+
display: block;
|
|
38
|
+
padding: 10px 15px;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
color: black;
|
|
41
|
+
}
|
|
42
|
+
.navigation .mini-nav-content {
|
|
43
|
+
display: none;
|
|
44
|
+
position: absolute;
|
|
45
|
+
background-color: hsl(0, 0%, 90%);
|
|
46
|
+
min-width: 160px;
|
|
47
|
+
box-shadow: 2px 2px 5px hsla(0, 0%, 0%, 0.8);
|
|
48
|
+
}
|
|
49
|
+
.navigation .mini-nav:hover .mini-nav-content {
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
52
|
+
.navigation .mini-nav:hover button {
|
|
53
|
+
background-color: hsl(0, 0%, 80%);
|
|
54
|
+
}
|
|
55
|
+
@media (max-width: 720px) {
|
|
56
|
+
.navigation .mini-nav {
|
|
57
|
+
display: inline-block;
|
|
58
|
+
visibility: visible;
|
|
59
|
+
}
|
|
60
|
+
.navigation .mini-nav button {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
visibility: visible;
|
|
63
|
+
}
|
|
64
|
+
.navigation .links {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
.navigation .title {
|
|
68
|
+
position: absolute;
|
|
69
|
+
padding-left: 0;
|
|
70
|
+
left: -2rem;
|
|
71
|
+
scale: 0.5;
|
|
72
|
+
}
|
|
73
|
+
.navigation .avatar {
|
|
74
|
+
position: absolute;
|
|
75
|
+
padding-right: -4rem;
|
|
76
|
+
right: 0;
|
|
77
|
+
scale: 0.8;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@media (max-width: 400px) {
|
|
81
|
+
.navigation {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
height: auto;
|
|
86
|
+
}
|
|
87
|
+
.navigation .title {
|
|
88
|
+
display: flex;
|
|
89
|
+
position: relative;
|
|
90
|
+
justify-self: center;
|
|
91
|
+
}
|
|
92
|
+
.navigation .mini-nav {
|
|
93
|
+
display: flex;
|
|
94
|
+
position: relative;
|
|
95
|
+
}
|
|
96
|
+
.navigation .mini-nav button {
|
|
97
|
+
display: flex;
|
|
98
|
+
position: relative;
|
|
99
|
+
}
|
|
100
|
+
.navigation .avatar {
|
|
101
|
+
display: flex;
|
|
102
|
+
position: relative;
|
|
103
|
+
justify-self: center;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
.navigation .avatar {
|
|
107
|
+
font-size: large;
|
|
108
|
+
font-weight: 500;
|
|
109
|
+
color: black;
|
|
110
|
+
text-decoration: none;
|
|
111
|
+
position: absolute;
|
|
112
|
+
right: 20px;
|
|
113
|
+
top: 10px;
|
|
114
|
+
}
|
|
115
|
+
.navigation a {
|
|
116
|
+
font-size: larger;
|
|
117
|
+
font-weight: 500;
|
|
118
|
+
text-decoration: none;
|
|
119
|
+
color: black;
|
|
120
|
+
padding: 10px 15px;
|
|
121
|
+
}
|
|
122
|
+
.navigation a:hover {
|
|
123
|
+
background-color: hsl(0, 0%, 90%);
|
|
124
|
+
}
|
|
125
|
+
.navigation .dropdown {
|
|
126
|
+
display: inline-block;
|
|
127
|
+
}
|
|
128
|
+
.navigation .dropdown button {
|
|
129
|
+
background-color: hsl(0, 0%, 95%);
|
|
130
|
+
color: back;
|
|
131
|
+
font-size: larger;
|
|
132
|
+
font-weight: 500;
|
|
133
|
+
border: none;
|
|
134
|
+
padding: 10px 15px;
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
.navigation .dropdown a {
|
|
138
|
+
display: block;
|
|
139
|
+
padding: 10px 15px;
|
|
140
|
+
text-decoration: none;
|
|
141
|
+
color: black;
|
|
142
|
+
}
|
|
143
|
+
.navigation .dropdown-content {
|
|
144
|
+
display: none;
|
|
145
|
+
position: absolute;
|
|
146
|
+
background-color: hsl(0, 0%, 90%);
|
|
147
|
+
min-width: 160px;
|
|
148
|
+
box-shadow: 2px 2px 5px hsla(0, 0%, 0%, 0.8);
|
|
149
|
+
}
|
|
150
|
+
.navigation .dropdown:hover .dropdown-content {
|
|
151
|
+
display: block;
|
|
152
|
+
}
|
|
153
|
+
.navigation .dropdown:hover button {
|
|
154
|
+
background-color: hsl(0, 0%, 80%);
|
|
155
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="astro/client" />
|
|
2
|
+
|
|
3
|
+
declare module 'studiocms:components' {
|
|
4
|
+
export const Avatar: typeof import('studiocms/components/Avatar.astro').default;
|
|
5
|
+
export const FormattedDate: typeof import('studiocms/components/FormattedDate.astro').default;
|
|
6
|
+
export const GenericHeader: typeof import('studiocms/components/GenericHeader.astro').default;
|
|
7
|
+
export const Navigation: typeof import('studiocms/components/Navigation.astro').default;
|
|
8
|
+
export const Generator: typeof import('studiocms/components/Generator.astro').default;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module 'studiocms:imageHandler/components' {
|
|
12
|
+
export const CustomImage: typeof import('studiocms/components/image/CustomImage.astro').default;
|
|
13
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type StudioCMSPlugin } from 'studiocms/plugins';
|
|
2
|
+
import type { StudioCMSBlogOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates and configures the StudioCMS Blog plugin.
|
|
5
|
+
*
|
|
6
|
+
* @param {StudioCMSBlogOptions} [options] - Optional configuration options for the blog plugin.
|
|
7
|
+
* @returns {StudioCMSPlugin} The configured StudioCMS plugin.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This function sets up the StudioCMS Blog plugin with the provided options or default values.
|
|
11
|
+
* It configures the plugin's identifier, name, minimum version, frontend navigation links, page types,
|
|
12
|
+
* sitemap settings, and integration hooks.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const blogPlugin = studioCMSBlogPlugin({
|
|
17
|
+
* blog: {
|
|
18
|
+
* title: 'My Blog',
|
|
19
|
+
* enableRSS: true,
|
|
20
|
+
* route: '/my-blog'
|
|
21
|
+
* },
|
|
22
|
+
* sitemap: true,
|
|
23
|
+
* injectRoutes: true
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param {StudioCMSBlogOptions} [options.blog] - Blog-specific options.
|
|
28
|
+
* @param {string} [options.blog.title] - The title of the blog. Defaults to 'Blog'.
|
|
29
|
+
* @param {boolean} [options.blog.enableRSS] - Whether to enable RSS feed. Defaults to true.
|
|
30
|
+
* @param {string} [options.blog.route] - The route for the blog. Defaults to '/blog'.
|
|
31
|
+
* @param {boolean} [options.sitemap] - Whether to trigger sitemap generation. Defaults to true.
|
|
32
|
+
* @param {boolean} [options.injectRoutes] - Whether to inject routes for the blog. Defaults to true.
|
|
33
|
+
*/
|
|
34
|
+
export declare function studioCMSBlogPlugin(options?: StudioCMSBlogOptions): StudioCMSPlugin;
|
|
35
|
+
export default studioCMSBlogPlugin;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { addVirtualImports, createResolver } from "astro-integration-kit";
|
|
2
|
+
import { pathWithBase } from "studiocms/lib/pathGenerators.js";
|
|
3
|
+
import { definePlugin } from "studiocms/plugins";
|
|
4
|
+
const packageIdentifier = "@studiocms/blog";
|
|
5
|
+
function studioCMSBlogPlugin(options) {
|
|
6
|
+
const title = options?.blog?.title || "Blog";
|
|
7
|
+
const enableRSS = options?.blog?.enableRSS || true;
|
|
8
|
+
const route = pathWithBase(options?.blog?.route || "/blog");
|
|
9
|
+
const sitemap = options?.sitemap ?? true;
|
|
10
|
+
const injectRoutes = options?.injectRoutes ?? true;
|
|
11
|
+
const { resolve } = createResolver(import.meta.url);
|
|
12
|
+
return definePlugin({
|
|
13
|
+
identifier: packageIdentifier,
|
|
14
|
+
name: "StudioCMS Blog",
|
|
15
|
+
// TODO: Update this to the correct version when the package is ready to be published
|
|
16
|
+
studiocmsMinimumVersion: "0.1.0-beta.7",
|
|
17
|
+
frontendNavigationLinks: [{ label: title, href: route }],
|
|
18
|
+
pageTypes: [{ identifier: packageIdentifier, label: "Blog Post (StudioCMS Blog)" }],
|
|
19
|
+
triggerSitemap: sitemap,
|
|
20
|
+
sitemaps: [
|
|
21
|
+
{
|
|
22
|
+
pluginName: packageIdentifier,
|
|
23
|
+
sitemapXMLEndpointPath: resolve("./routes/sitemap-posts.xml.js")
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
pluginName: "pages",
|
|
27
|
+
sitemapXMLEndpointPath: resolve("./routes/sitemap-md.xml.js")
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
integration: {
|
|
31
|
+
name: packageIdentifier,
|
|
32
|
+
hooks: {
|
|
33
|
+
"astro:config:setup": async (params) => {
|
|
34
|
+
const { injectRoute } = params;
|
|
35
|
+
if (injectRoutes) {
|
|
36
|
+
injectRoute({
|
|
37
|
+
entrypoint: resolve("./routes/[...slug].astro"),
|
|
38
|
+
pattern: pathWithBase("[...slug]"),
|
|
39
|
+
prerender: false
|
|
40
|
+
});
|
|
41
|
+
injectRoute({
|
|
42
|
+
entrypoint: resolve("./routes/blog/index.astro"),
|
|
43
|
+
pattern: `${route}`,
|
|
44
|
+
prerender: false
|
|
45
|
+
});
|
|
46
|
+
injectRoute({
|
|
47
|
+
entrypoint: resolve("./routes/blog/[...slug].astro"),
|
|
48
|
+
pattern: `${route}/[...slug]`,
|
|
49
|
+
prerender: false
|
|
50
|
+
});
|
|
51
|
+
if (enableRSS) {
|
|
52
|
+
injectRoute({
|
|
53
|
+
entrypoint: resolve("./routes/rss.xml.js"),
|
|
54
|
+
pattern: pathWithBase("rss.xml"),
|
|
55
|
+
prerender: false
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
addVirtualImports(params, {
|
|
60
|
+
name: packageIdentifier,
|
|
61
|
+
imports: {
|
|
62
|
+
"studiocms:blog/config": `
|
|
63
|
+
const config = {
|
|
64
|
+
title: "${title}",
|
|
65
|
+
enableRSS: ${enableRSS},
|
|
66
|
+
route: "${route}"
|
|
67
|
+
}
|
|
68
|
+
export default config;
|
|
69
|
+
`
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
var index_default = studioCMSBlogPlugin;
|
|
78
|
+
export {
|
|
79
|
+
index_default as default,
|
|
80
|
+
studioCMSBlogPlugin
|
|
81
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { defaultFrontEndConfig } from 'studiocms:config';
|
|
3
|
+
import studioCMS_SDK from 'studiocms:sdk/cache';
|
|
4
|
+
import BaseHead from '../components/BaseHead.astro';
|
|
5
|
+
import Footer from '../components/Footer.astro';
|
|
6
|
+
import Navigation from '../components/Navigation.astro';
|
|
7
|
+
|
|
8
|
+
const { title: SiteTitle, description: SiteDescription } = (await studioCMS_SDK.GET.siteConfig())
|
|
9
|
+
.data || {
|
|
10
|
+
title: 'StudioCMS - Database Unavailable',
|
|
11
|
+
description: 'StudioCMS - Database Unavailable',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let htmlDefaultLanguage = 'en';
|
|
15
|
+
|
|
16
|
+
if (defaultFrontEndConfig) {
|
|
17
|
+
if (typeof defaultFrontEndConfig === 'object' && defaultFrontEndConfig.htmlDefaultLanguage) {
|
|
18
|
+
htmlDefaultLanguage = defaultFrontEndConfig.htmlDefaultLanguage;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type Props = {
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
lang?: string | undefined;
|
|
26
|
+
heroImage?: string | undefined;
|
|
27
|
+
siteTitle?: string | undefined;
|
|
28
|
+
siteDescription?: string | undefined;
|
|
29
|
+
pageTitleDelimiter?: string | undefined;
|
|
30
|
+
pageDescriptionDelimiter?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const {
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
heroImage,
|
|
37
|
+
lang = htmlDefaultLanguage || 'en',
|
|
38
|
+
siteTitle = SiteTitle,
|
|
39
|
+
siteDescription = SiteDescription,
|
|
40
|
+
pageTitleDelimiter = '|',
|
|
41
|
+
pageDescriptionDelimiter = '-',
|
|
42
|
+
} = Astro.props;
|
|
43
|
+
|
|
44
|
+
const pageDescription = `${description} ${pageDescriptionDelimiter} ${siteDescription}`;
|
|
45
|
+
const pageTitle = `${title} ${pageTitleDelimiter} ${siteTitle}`;
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
<!doctype html>
|
|
49
|
+
<html {lang}>
|
|
50
|
+
<head>
|
|
51
|
+
<BaseHead title={pageTitle} description={pageDescription} image={heroImage} lang={lang}/>
|
|
52
|
+
</head>
|
|
53
|
+
<body>
|
|
54
|
+
<Navigation />
|
|
55
|
+
|
|
56
|
+
<slot />
|
|
57
|
+
|
|
58
|
+
<Footer {siteTitle} />
|
|
59
|
+
</body>
|
|
60
|
+
</html>
|
package/dist/lib.d.js
ADDED
|
File without changes
|