Refactor tu use astrowind:config virtual import
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { SITE } from '~/utils/config';
|
import { SITE } from 'astrowind:config';
|
||||||
---
|
---
|
||||||
|
|
||||||
<span class="self-center ml-2 rtl:ml-0 rtl:mr-2 text-2xl md:text-xl font-bold text-gray-900 whitespace-nowrap dark:text-white">
|
<span class="self-center ml-2 rtl:ml-0 rtl:mr-2 text-2xl md:text-xl font-bold text-gray-900 whitespace-nowrap dark:text-white">
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { APP_BLOG } from '~/utils/config';
|
import { APP_BLOG } from 'astrowind:config';
|
||||||
import type { Post } from '~/types';
|
import type { Post } from '~/types';
|
||||||
|
|
||||||
import Image from '~/components/common/Image.astro';
|
import Image from '~/components/common/Image.astro';
|
||||||
|
@@ -4,7 +4,7 @@ import { Icon } from 'astro-icon/components';
|
|||||||
import Image from '~/components/common/Image.astro';
|
import Image from '~/components/common/Image.astro';
|
||||||
import PostTags from '~/components/blog/Tags.astro';
|
import PostTags from '~/components/blog/Tags.astro';
|
||||||
|
|
||||||
import { APP_BLOG } from '~/utils/config';
|
import { APP_BLOG } from 'astrowind:config';
|
||||||
import type { Post } from '~/types';
|
import type { Post } from '~/types';
|
||||||
|
|
||||||
import { getPermalink } from '~/utils/permalinks';
|
import { getPermalink } from '~/utils/permalinks';
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { APP_BLOG } from "~/utils/config";
|
import { APP_BLOG } from "astrowind:config";
|
||||||
|
|
||||||
import { fetchPosts, getRelatedPosts } from "~/utils/blog";
|
import { fetchPosts, getRelatedPosts } from "~/utils/blog";
|
||||||
import BlogHighlightedPosts from "../widgets/BlogHighlightedPosts.astro";
|
import BlogHighlightedPosts from "../widgets/BlogHighlightedPosts.astro";
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { getPermalink } from '~/utils/permalinks';
|
import { getPermalink } from '~/utils/permalinks';
|
||||||
|
|
||||||
import { APP_BLOG } from '~/utils/config';
|
import { APP_BLOG } from 'astrowind:config';
|
||||||
import type { Post } from '~/types';
|
import type { Post } from '~/types';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
import { getBlogPermalink } from '~/utils/permalinks';
|
import { getBlogPermalink } from '~/utils/permalinks';
|
||||||
import { I18N } from '~/utils/config';
|
import { I18N } from 'astrowind:config';
|
||||||
import Button from '~/components/ui/Button.astro';
|
import Button from '~/components/ui/Button.astro';
|
||||||
|
|
||||||
const { textDirection } = I18N;
|
const { textDirection } = I18N;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { GoogleAnalytics } from '@astrolib/analytics';
|
import { GoogleAnalytics } from '@astrolib/analytics';
|
||||||
import { ANALYTICS } from '~/utils/config';
|
import { ANALYTICS } from 'astrowind:config';
|
||||||
---
|
---
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { UI } from "~/utils/config";
|
import { UI } from "astrowind:config";
|
||||||
|
|
||||||
// TODO: This code is temporary
|
// TODO: This code is temporary
|
||||||
---
|
---
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { UI } from '~/utils/config';
|
import { UI } from 'astrowind:config';
|
||||||
---
|
---
|
||||||
|
|
||||||
<script is:inline define:vars={{ defaultTheme: UI.theme }}>
|
<script is:inline define:vars={{ defaultTheme: UI.theme }}>
|
||||||
|
@@ -4,7 +4,7 @@ import { AstroSeo } from '@astrolib/seo';
|
|||||||
|
|
||||||
import type { Props as AstroSeoProps } from '@astrolib/seo';
|
import type { Props as AstroSeoProps } from '@astrolib/seo';
|
||||||
|
|
||||||
import { SITE, METADATA, I18N } from '~/utils/config';
|
import { SITE, METADATA, I18N } from 'astrowind:config';
|
||||||
import type { MetaData } from '~/types';
|
import type { MetaData } from '~/types';
|
||||||
import { getCanonical } from '~/utils/permalinks';
|
import { getCanonical } from '~/utils/permalinks';
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { SITE } from "~/utils/config";
|
import { SITE } from "astrowind:config";
|
||||||
---
|
---
|
||||||
|
|
||||||
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}
|
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
|
|
||||||
import { UI } from '~/utils/config';
|
import { UI } from 'astrowind:config';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
label?: string;
|
label?: string;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { APP_BLOG } from "~/utils/config";
|
import { APP_BLOG } from "astrowind:config";
|
||||||
|
|
||||||
import Grid from "~/components/blog/Grid.astro";
|
import Grid from "~/components/blog/Grid.astro";
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { APP_BLOG } from "~/utils/config";
|
import { APP_BLOG } from "astrowind:config";
|
||||||
|
|
||||||
import Grid from "~/components/blog/Grid.astro";
|
import Grid from "~/components/blog/Grid.astro";
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
import { SITE } from '~/utils/config';
|
import { SITE } from 'astrowind:config';
|
||||||
import { getHomePermalink } from '~/utils/permalinks';
|
import { getHomePermalink } from '~/utils/permalinks';
|
||||||
|
|
||||||
interface Link {
|
interface Link {
|
||||||
|
@@ -32,4 +32,4 @@ const { metadata } = Astro.props;
|
|||||||
</slot>
|
</slot>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
<slot />
|
<slot />
|
||||||
</PageLayout>
|
</PageLayout>
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import '~/assets/styles/tailwind.css';
|
import '~/assets/styles/tailwind.css';
|
||||||
|
|
||||||
import { I18N } from '~/utils/config';
|
import { I18N } from 'astrowind:config';
|
||||||
|
|
||||||
import CommonMeta from '~/components/common/CommonMeta.astro';
|
import CommonMeta from '~/components/common/CommonMeta.astro';
|
||||||
import Favicons from '~/components/Favicons.astro';
|
import Favicons from '~/components/Favicons.astro';
|
||||||
|
@@ -28,4 +28,4 @@ const { metadata } = Astro.props;
|
|||||||
<slot name="footer">
|
<slot name="footer">
|
||||||
<Footer {...footerData} />
|
<Footer {...footerData} />
|
||||||
</slot>
|
</slot>
|
||||||
</Layout>
|
</Layout>
|
@@ -1,6 +1,6 @@
|
|||||||
import { getRssString } from '@astrojs/rss';
|
import { getRssString } from '@astrojs/rss';
|
||||||
|
|
||||||
import { SITE, METADATA, APP_BLOG } from '~/utils/config';
|
import { SITE, METADATA, APP_BLOG } from 'astrowind:config';
|
||||||
import { fetchPosts } from '~/utils/blog';
|
import { fetchPosts } from '~/utils/blog';
|
||||||
import { getPermalink } from '~/utils/permalinks';
|
import { getPermalink } from '~/utils/permalinks';
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ import type { PaginateFunction } from 'astro';
|
|||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
import type { CollectionEntry } from 'astro:content';
|
import type { CollectionEntry } from 'astro:content';
|
||||||
import type { Post } from '~/types';
|
import type { Post } from '~/types';
|
||||||
import { APP_BLOG } from '~/utils/config';
|
import { APP_BLOG } from 'astrowind:config';
|
||||||
import { cleanSlug, trimSlash, BLOG_BASE, POST_PERMALINK_PATTERN, CATEGORY_BASE, TAG_BASE } from './permalinks';
|
import { cleanSlug, trimSlash, BLOG_BASE, POST_PERMALINK_PATTERN, CATEGORY_BASE, TAG_BASE } from './permalinks';
|
||||||
|
|
||||||
const generatePermalink = async ({
|
const generatePermalink = async ({
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import slugify from 'limax';
|
import slugify from 'limax';
|
||||||
|
|
||||||
import { SITE, APP_BLOG } from '~/utils/config';
|
import { SITE, APP_BLOG } from 'astrowind:config';
|
||||||
|
|
||||||
import { trim } from '~/utils/utils';
|
import { trim } from '~/utils/utils';
|
||||||
|
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
import { I18N } from '~/utils/config';
|
import { I18N } from 'astrowind:config';
|
||||||
|
|
||||||
const formatter: Intl.DateTimeFormat =
|
export const formatter: Intl.DateTimeFormat = new Intl.DateTimeFormat(I18N?.language, {
|
||||||
I18N?.dateFormatter ||
|
year: 'numeric',
|
||||||
new Intl.DateTimeFormat('en', {
|
month: 'short',
|
||||||
year: 'numeric',
|
day: 'numeric',
|
||||||
month: 'short',
|
timeZone: 'UTC',
|
||||||
day: 'numeric',
|
});
|
||||||
timeZone: 'UTC',
|
|
||||||
});
|
|
||||||
|
|
||||||
export const getFormattedDate = (date: Date): string => (date ? formatter.format(date) : '');
|
export const getFormattedDate = (date: Date): string => (date ? formatter.format(date) : '');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user