@hagicode/hagilight-docusaurus 0.9.1 → 0.9.2-dev.102.1.daf22c1
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/README.md +6 -0
- package/dist/client/promoto.js +2 -1
- package/dist/global-data.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/theme/Footer/FooterView.d.ts +4 -2
- package/dist/theme/Footer/FooterView.js +5 -2
- package/dist/theme/Footer/index.js +2 -2
- package/package.json +2 -2
- package/promoto.css +2 -1
- package/styles.css +4 -0
package/README.md
CHANGED
|
@@ -71,6 +71,12 @@ An analytics object enables its provider when it contains an ID. Set `enabled` e
|
|
|
71
71
|
- `seo.organization.url` and `seo.organization.logo` must be absolute HTTP(S) URLs.
|
|
72
72
|
- The Organization and WebSite JSON-LD is still emitted when a site replaces `SiteMetadata`.
|
|
73
73
|
|
|
74
|
+
## Build line
|
|
75
|
+
|
|
76
|
+
The Hagilight footer shows `Branch:`, `Commit:`, and `Built:` after the attribution. The values are resolved from the site directory: `HAGILIGHT_BUILD_BRANCH` and `HAGILIGHT_BUILD_COMMIT`, then Git, then `unknown`; the core README gives the order. The line belongs to the Hagilight footer, so it is absent when `footer` is disabled. For a detached-HEAD CI checkout, set `HAGILIGHT_BUILD_BRANCH` in the build step as shown in the Astro README.
|
|
77
|
+
|
|
78
|
+
Docusaurus evaluates the plugin again for each locale it builds, so each locale resolves its own `Built:` time. Pages within one locale share that time, but two locales built in the same run can differ by a few seconds.
|
|
79
|
+
|
|
74
80
|
## Locale catalog
|
|
75
81
|
|
|
76
82
|
`@hagicode/hagilight-docusaurus/locales` exports the locale table used by the plugin:
|
package/dist/client/promoto.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { definePromotoBannerElement } from '@hagicode/hagilight-core/promoto-banner';
|
|
1
|
+
import { definePromotoBannerElement, recordSiteVisit } from '@hagicode/hagilight-core/promoto-banner';
|
|
2
2
|
import { PROMOTO_SHELL_MARKUP } from './promoto-markup.js';
|
|
3
3
|
const ELEMENT_NAME = 'hagilight-promoto-banner';
|
|
4
4
|
const DEFAULT_LOCALE = 'en-US';
|
|
@@ -20,4 +20,5 @@ export function mountPromotoBanner(doc, locale) {
|
|
|
20
20
|
export function onRouteDidUpdate() {
|
|
21
21
|
definePromotoBannerElement();
|
|
22
22
|
mountPromotoBanner(document, document.documentElement.lang || DEFAULT_LOCALE);
|
|
23
|
+
recordSiteVisit();
|
|
23
24
|
}
|
package/dist/global-data.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { LoadContext } from '@docusaurus/types';
|
|
2
|
+
import type { BuildInfo } from '@hagicode/hagilight-core/build-info';
|
|
2
3
|
import type { ResolvedHagilightOptions } from './options.js';
|
|
3
4
|
export declare const PLUGIN_NAME = "@hagicode/hagilight-docusaurus";
|
|
4
5
|
export interface HagilightGlobalData {
|
|
5
6
|
version: string;
|
|
6
7
|
options: ResolvedHagilightOptions;
|
|
7
8
|
i18n: LoadContext['i18n'];
|
|
9
|
+
buildInfo: BuildInfo;
|
|
8
10
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { resolveBuildInfo } from '@hagicode/hagilight-core/build-info-resolver';
|
|
3
4
|
import { fiftyOneLaHeadTags, googleAnalyticsHeadTags } from './analytics.js';
|
|
4
5
|
import { collectFeedItems, feedHeadTags, writeDiscoveryOutputs } from './discovery.js';
|
|
5
6
|
import { PLUGIN_NAME } from './global-data.js';
|
|
@@ -35,6 +36,7 @@ function createPlugin(context, options) {
|
|
|
35
36
|
version: PACKAGE_VERSION,
|
|
36
37
|
options,
|
|
37
38
|
i18n: context.i18n,
|
|
39
|
+
buildInfo: resolveBuildInfo({ root: context.siteDir }),
|
|
38
40
|
};
|
|
39
41
|
const themeEnabled = options.footer || options.seo.enabled;
|
|
40
42
|
const site = {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type BuildInfo } from '@hagicode/hagilight-core/build-info';
|
|
2
3
|
import type { FooterLinks } from '../../footer.js';
|
|
3
4
|
export interface FooterViewProps {
|
|
4
5
|
links: FooterLinks;
|
|
5
6
|
version: string;
|
|
6
7
|
year: number;
|
|
8
|
+
buildInfo?: BuildInfo;
|
|
7
9
|
}
|
|
8
|
-
export declare function FooterView({ links, version, year }: FooterViewProps): ReactElement;
|
|
10
|
+
export declare function FooterView({ links, version, year, buildInfo }: FooterViewProps): ReactElement;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
2
3
|
import { siteLinkGaAttributes } from '@hagicode/hagilight-core/analytics-events';
|
|
4
|
+
import { buildInfoItems } from '@hagicode/hagilight-core/build-info';
|
|
3
5
|
function LinkSection({ heading, navLabel, links, tagged }) {
|
|
4
6
|
return (_jsxs("section", { children: [_jsx("h2", { children: heading }), _jsx("nav", { "aria-label": navLabel, children: _jsx("ul", { children: links.map((link) => (_jsx("li", { children: _jsx("a", { href: link.href, target: link.target, rel: link.rel, "aria-label": link.ariaLabel, ...(tagged ? siteLinkGaAttributes(link, 'footer') : {}), children: link.label }) }, link.id))) }) })] }));
|
|
5
7
|
}
|
|
6
|
-
export function FooterView({ links, version, year }) {
|
|
8
|
+
export function FooterView({ links, version, year, buildInfo }) {
|
|
7
9
|
const { labels } = links;
|
|
8
|
-
|
|
10
|
+
const buildItems = buildInfoItems(buildInfo);
|
|
11
|
+
return (_jsxs("footer", { className: "hagilight-footer", children: [_jsxs("div", { className: "hagilight-footer__sections", children: [links.relatedSites.length > 0 && (_jsxs("section", { children: [_jsx("h2", { children: labels.relatedSites }), _jsx("nav", { "aria-label": labels.navigation.relatedSites, children: _jsx("ul", { children: links.relatedSites.map((site) => (_jsx("li", { children: _jsx("a", { href: site.href, target: site.target, rel: site.rel, children: site.name }) }, site.id))) }) })] })), _jsx(LinkSection, { heading: labels.quickLinks, navLabel: labels.navigation.quickLinks, links: links.quick, tagged: true }), _jsx(LinkSection, { heading: labels.community, navLabel: labels.navigation.community, links: links.community, tagged: true })] }), links.filings.length > 0 && (_jsx("nav", { className: "hagilight-footer__filings", "aria-label": labels.navigation.filings, children: links.filings.map((link) => (_jsx("a", { href: link.href, target: link.target, rel: link.rel, "aria-label": link.ariaLabel, children: link.label }, link.id))) })), _jsxs("p", { className: "hagilight-footer__copyright", children: [_jsxs("span", { children: ["\u00A9 ", year, " HagiCode"] }), ' | ', _jsxs("span", { className: "hagilight-footer__attribution", children: ["Powered By hagilight-docusaurus@", version] }), buildItems.map((item) => (_jsxs(Fragment, { children: [' | ', _jsxs("span", { className: "hagilight-footer__build", "data-build-field": item.field, title: item.title, "data-build-commit": item.title, children: [item.label, ": ", item.datetime ? _jsx("time", { dateTime: item.datetime, children: item.text }) : item.text] })] }, item.field)))] })] }));
|
|
9
12
|
}
|
|
@@ -7,7 +7,7 @@ import { PLUGIN_NAME } from '../../global-data.js';
|
|
|
7
7
|
import { FooterView } from './FooterView.js';
|
|
8
8
|
export default function Footer() {
|
|
9
9
|
const { i18n, siteConfig } = useDocusaurusContext();
|
|
10
|
-
const { version, options } = usePluginData(PLUGIN_NAME);
|
|
10
|
+
const { version, options, buildInfo } = usePluginData(PLUGIN_NAME);
|
|
11
11
|
if (!options.footer)
|
|
12
12
|
return _jsx(FooterDefaults, {});
|
|
13
13
|
const links = resolveFooterLinks({
|
|
@@ -16,5 +16,5 @@ export default function Footer() {
|
|
|
16
16
|
links: options.links,
|
|
17
17
|
rssEnabled: options.rss.enabled,
|
|
18
18
|
});
|
|
19
|
-
return _jsx(FooterView, { links: links, version: version, year: new Date().getFullYear() });
|
|
19
|
+
return (_jsx(FooterView, { links: links, version: version, year: new Date().getFullYear(), buildInfo: buildInfo }));
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/hagilight-docusaurus",
|
|
3
|
-
"version": "0.9.1",
|
|
3
|
+
"version": "0.9.2-dev.102.1.daf22c1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Docusaurus plugin for HagiCode site features: footer, analytics, promote card, locales, SEO, sitemap, robots.txt, and RSS",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@docusaurus/types": "^3.9.2",
|
|
41
|
-
"@hagicode/hagilight-core": "0.9.1"
|
|
41
|
+
"@hagicode/hagilight-core": "0.9.2-dev.102.1.daf22c1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@docusaurus/core": "^3.9.2",
|
package/promoto.css
CHANGED
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
transition: opacity 0.24s ease, visibility 0s linear;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.hagilight-promoto[data-state='footer-hidden'] .hagilight-promoto__shell
|
|
42
|
+
.hagilight-promoto[data-state='footer-hidden'] .hagilight-promoto__shell,
|
|
43
|
+
.hagilight-promoto[data-state='top-hidden'] .hagilight-promoto__shell {
|
|
43
44
|
opacity: 0;
|
|
44
45
|
visibility: hidden;
|
|
45
46
|
pointer-events: none;
|