@turnipxenon/pineapple 4.1.3 → 4.2.0

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.
@@ -17,50 +17,38 @@ export const load = async (): Promise<OverridableMetaProps> => {
17
17
  -->
18
18
 
19
19
  <script lang="ts">
20
- import WebThumbnailImage from "../../assets/placeholder/placeholder_circle.png";
20
+ import { pinyaHead } from "../../ui/templates/runes.svelte";
21
21
 
22
-
23
- import { page } from "$app/stores";
24
- import type { OverridableMetaProps } from "./OverridableMetaProps";
25
22
  interface Props {
26
23
  rootUrl?: string;
27
24
  title?: string;
28
25
  ogTitle?: string;
29
26
  ogDescription?: string;
30
- ogImage?: any;
27
+ ogImage?: string[];
31
28
  }
32
29
 
33
30
  let {
34
- rootUrl = "http://localhost:5173",
35
- title = "Welcome to my portfolio",
36
- ogTitle = "Turnip time!",
37
- ogDescription = "Welcome to Turnip's test portfolio",
38
- ogImage = WebThumbnailImage
31
+ rootUrl = undefined,
32
+ title = undefined,
33
+ ogTitle = undefined,
34
+ ogDescription = undefined,
35
+ ogImage = undefined
39
36
  }: Props = $props();
40
37
 
41
- const data: OverridableMetaProps = $state({
42
- title: "Welcome to my portfolio",
43
- ogUrl: "https://www.crouton.net/",
44
- ogTitle: "Turnip time!",
45
- ogDescription: "Welcome to Turnip's test portfolio",
46
- ogImage: WebThumbnailImage
47
- });
48
- page.subscribe(p => {
49
- const pageData: OverridableMetaProps = p.data;
50
- data.title = pageData.title ?? title;
51
- data.ogUrl = `${rootUrl}${p.url.pathname}`;
52
- data.ogTitle = pageData.ogTitle ?? ogTitle;
53
- data.ogDescription = pageData.ogDescription ?? ogDescription;
54
- data.ogImage = pageData.ogImage ?? ogImage;
55
- });
38
+ if (rootUrl) {
39
+ pinyaHead.rootUrl = rootUrl;
40
+ }
41
+ if (title) {
42
+ console.log('setting titel', title)
43
+ pinyaHead.title = title;
44
+ }
45
+ if (ogTitle) {
46
+ pinyaHead.ogTitle = ogTitle;
47
+ }
48
+ if (ogDescription) {
49
+ pinyaHead.ogDescription = ogDescription;
50
+ }
51
+ if (ogImage) {
52
+ pinyaHead.ogImage = ogImage;
53
+ }
56
54
  </script>
57
-
58
- <svelte:head>
59
- <meta charset="utf-8" />
60
- <title>{data.title}</title>
61
- <meta name="twitter:card" content="summary" />
62
- <meta property="og:url" content={data.ogUrl} />
63
- <meta property="og:title" content={data.ogTitle} />
64
- <meta property="og:description" content={data.ogDescription} />
65
- <meta property="og:image" content={data.ogImage} />
66
- </svelte:head>
@@ -3,7 +3,7 @@ interface Props {
3
3
  title?: string;
4
4
  ogTitle?: string;
5
5
  ogDescription?: string;
6
- ogImage?: any;
6
+ ogImage?: string[];
7
7
  }
8
8
  declare const OverridableMeta: import("svelte").Component<Props, {}, "">;
9
9
  type OverridableMeta = ReturnType<typeof OverridableMeta>;
@@ -20,6 +20,8 @@
20
20
  {/if}
21
21
  {:else if child.type === 'heading'}
22
22
  <ParsnipHeading heading={child} />
23
+ {:else if child.type === 'thematicBreak'}
24
+ <hr>
23
25
  {:else if child.type === 'blockquote'}
24
26
  <!-- todo: do advanced things like callout blocks -->
25
27
  <blockquote>
@@ -12,6 +12,8 @@ export interface SimplifiedEntry {
12
12
  * url of preview image relative to base blog path
13
13
  */
14
14
  preview?: string;
15
+ previewAlt?: string;
16
+ tagline?: string;
15
17
  }
16
18
  export interface ParsnipEntrySummary extends SimplifiedEntry {
17
19
  /**
@@ -16,6 +16,10 @@
16
16
  </strong>
17
17
  {:else if child.type === 'inlineCode'}
18
18
  <code class="inline-code">{child.value}</code>
19
+ {:else if child.type === 'link'}
20
+ <a href={child.url}>
21
+ <Self phrasingChildren={child.children} />
22
+ </a>
19
23
  {:else if child.type === 'embedWikilink'}
20
24
  <ParsnipEmbedWikilink wikilink={child} />
21
25
  {:else if child.type === 'wikilink'}
@@ -17,4 +17,4 @@
17
17
 
18
18
  <!-- todo(turnip): determine appropriate media -->
19
19
  <!-- todo(turnip): add alt text -->
20
- <a href={`${getWebBaseUrl()}/${wikilink.fileAccessor.slug}`}>{wikilink.fileAccessor.target}</a>
20
+ <a href={`${getWebBaseUrl()}/${wikilink.fileAccessor.slug}`} data-sveltekit-reload>{wikilink.fileAccessor.target}</a>
@@ -21,8 +21,8 @@
21
21
  <OverridableMeta
22
22
  title={parsnipEntry.basename}
23
23
  ogTitle={parsnipEntry.basename}
24
- ogDescription=""
25
- ogImage={`${getCmsBaseUrl()}/${parsnipEntry.preview}`}
24
+ ogDescription={parsnipEntry.tagline}
25
+ ogImage={[`${getCmsBaseUrl()}/${parsnipEntry.preview}`]}
26
26
  />
27
27
 
28
28
  <BlogTemplate pageMeta={pageMeta}>
@@ -40,7 +40,7 @@
40
40
  pageSize = $bindable(5),
41
41
  currentIndex = $bindable(0),
42
42
  parsnipOverall = undefined,
43
- parsnipBasePath = '',
43
+ parsnipBasePath = ""
44
44
  }: Props = $props();
45
45
 
46
46
  const fileBasedList = parsePageMeta(fileList, jsonList, imageMap, compareFn);
@@ -51,8 +51,10 @@
51
51
  relativeLink: `${parsnipBasePath}${pf.slug}`,
52
52
  tags: pf.tags,
53
53
  imageUrl: pf.preview ? `${parsnipOverall.baseUrl}/${pf.preview}` : undefined,
54
+ imageAlt: pf.previewAlt,
54
55
  datePublished: pf.stat.ctime ? new Date(pf.stat.ctime).toISOString().split("T")[0] : undefined,
55
- lastUpdated: pf.stat.mtime ? new Date(pf.stat.mtime).toISOString().split("T")[0] : undefined
56
+ lastUpdated: pf.stat.mtime ? new Date(pf.stat.mtime).toISOString().split("T")[0] : undefined,
57
+ description: pf.tagline
56
58
  };
57
59
  return meta;
58
60
  }) ?? [];
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { pinyaHead } from "./runes.svelte";
2
3
  import { ModeWatcher } from "mode-watcher";
3
4
  import { Modals } from "svelte-modals";
4
5
  import { page } from "$app/state";
@@ -9,8 +10,21 @@
9
10
  import { ToastProvider } from "@skeletonlabs/skeleton-svelte";
10
11
 
11
12
  let { children } = $props();
13
+
14
+ const ogUrl = $derived(`${pinyaHead.rootUrl}${page.url.pathname}`);
12
15
  </script>
13
16
 
17
+ <svelte:head>
18
+ <meta charset="utf-8" />
19
+ <title>{pinyaHead.title}</title>
20
+ <meta property="og:url" content={ogUrl} />
21
+ <meta property="og:title" content={pinyaHead.ogTitle} />
22
+ <meta property="og:description" content={pinyaHead.ogDescription} />
23
+ {#each pinyaHead.ogImage ?? [] as imgUrl, idx (`${idx}_${imgUrl}`)}
24
+ <meta property="og:image" content={imgUrl} />
25
+ {/each}
26
+ </svelte:head>
27
+
14
28
  <Modals>
15
29
  <!-- shown when any modal is opened -->
16
30
  {#snippet backdrop({ close })}
@@ -45,4 +59,4 @@
45
59
  background: rgba(0, 0, 0, 0.50);
46
60
  backdrop-filter: blur(4px);
47
61
  }
48
- </style>
62
+ </style>
@@ -0,0 +1,8 @@
1
+ export interface PinyaHead {
2
+ rootUrl?: string;
3
+ title?: string;
4
+ ogTitle?: string;
5
+ ogDescription?: string;
6
+ ogImage?: string[];
7
+ }
8
+ export declare const pinyaHead: PinyaHead;
@@ -0,0 +1,9 @@
1
+ import WebThumbnailImage from "../../assets/placeholder/placeholder_circle.png";
2
+ const defaultData = {
3
+ rootUrl: "http://localhost:5173",
4
+ title: "Welcome to my portfolio",
5
+ ogTitle: "Turnip time!",
6
+ ogDescription: "Welcome to Turnip's test portfolio",
7
+ ogImage: [WebThumbnailImage]
8
+ };
9
+ export const pinyaHead = $state({ ...defaultData });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turnipxenon/pineapple",
3
3
  "description": "personal package for base styling for other personal projects",
4
- "version": "4.1.3",
4
+ "version": "4.2.0",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && yarn package",