move other options to ENV
This commit is contained in:
parent
a0d7b52ccb
commit
2d354e8401
3 changed files with 24 additions and 7 deletions
|
@ -1,19 +1,20 @@
|
||||||
---
|
---
|
||||||
import config from "../../config.yaml";
|
import { Boolify } from "../lib/boolify";
|
||||||
const { href, text, icon } = Astro.props;
|
const { href, text, icon } = Astro.props;
|
||||||
|
const useIcons = Boolify(import.meta.env.PUBLIC_USEICONS);
|
||||||
---
|
---
|
||||||
|
|
||||||
{
|
{
|
||||||
config.socialIcons && (
|
useIcons && (
|
||||||
<a href={href} target="_blank" rel="noopener noreferrer">
|
<a href={href} target="_blank" rel="noopener noreferrer">
|
||||||
<i class={`fa-brands fa-${icon ? icon : text.toLowerCase()}`} />
|
<i class={`fa-brands fa-${icon ? icon : text.toLowerCase()} fa-2xl`} />
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!config.socialIcons && (
|
!useIcons && (
|
||||||
<a href={href} target="_blank" rel="noopener noreferrer">
|
<a href={href} target="_blank" rel="noopener noreferrer">
|
||||||
<i class={`fa-brands fa-${icon ? icon : text.toLowerCase()}`} />
|
{text}
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
---
|
---
|
||||||
import config from "../../config.yaml";
|
|
||||||
import pb from "../lib/pb";
|
import pb from "../lib/pb";
|
||||||
export const prerender = false
|
export const prerender = false
|
||||||
const backgroundRec = await pb.collection('images').getFirstListItem('useAsBackground=true');
|
const backgroundRec = await pb.collection('images').getFirstListItem('useAsBackground=true');
|
||||||
|
@ -15,7 +14,7 @@ const background = await pb.files.getUrl(backgroundRec, backgroundRec.file);
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<title>{config.title}</title>
|
<title>{import.meta.env.PUBLIC_TITLE}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
17
src/lib/boolify.ts
Normal file
17
src/lib/boolify.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
var BoolArray = [true, false, 'true', 'false', 1, 0];
|
||||||
|
const isBoolean = function (arg) {
|
||||||
|
if (BoolArray.indexOf(arg) === -1) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const Boolify = function (arg) {
|
||||||
|
if (BoolArray.indexOf(arg) === -1) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return (arg == true || arg == 'true' || arg == 1) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { isBoolean, Boolify };
|
Loading…
Add table
Reference in a new issue