Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(site): fetch real-time github stats and relocate product hunt badge to navbar

tianma-if6232614fce72
diff --git a/apps/site/src/components/hero.astro b/apps/site/src/components/hero.astro
index 4c594f5c..e91c46ff 100644
--- a/apps/site/src/components/hero.astro
+++ b/apps/site/src/components/hero.astro
@@ -56,16 +56,25 @@ const copy = siteCopy[locale].hero;
<Icon class="w-4 h-4" name="bx:bx-show" />
<span>{copy.demo}</span>
</Link>
- <Link
- size="lg"
- style="outline"
- rel="noopener"
+ <a
href="https://github.com/tianma-if/edgeever"
- class="flex gap-2 items-center justify-center px-6 py-3 border border-slate-200 hover:border-slate-400 bg-white/80 backdrop-blur-sm text-slate-800 transition-all rounded-full font-semibold text-sm hover:-translate-y-0.5 w-full sm:w-auto text-center"
- target="_blank">
- <Icon class="text-slate-800 w-4 h-4" name="bx:bxl-github" />
- <span>GitHub Star</span>
- </Link>
+ target="_blank"
+ rel="noopener"
+ aria-label="EdgeEver on GitHub"
+ class="group flex gap-2 items-center justify-center px-4 sm:px-4.5 py-3 border border-slate-200/90 hover:border-slate-400 bg-white/90 backdrop-blur-sm text-slate-800 transition-all rounded-full font-semibold text-sm hover:-translate-y-0.5 shadow-2xs hover:shadow-sm w-full sm:w-auto text-center"
+ >
+ <Icon class="text-slate-800 w-4 h-4 shrink-0 transition-transform duration-200 group-hover:scale-110" name="bx:bxl-github" />
+ <div class="flex items-center gap-1.5 font-medium text-xs">
+ <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-slate-100 text-slate-700 group-hover:bg-amber-50 group-hover:text-amber-800 transition-colors">
+ <Icon name="bx:bxs-star" class="w-3.5 h-3.5 text-amber-500" />
+ <span data-github-stars>--</span>
+ </span>
+ <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-slate-100 text-slate-700 group-hover:bg-slate-200/80 transition-colors">
+ <Icon name="bx:git-repo-forked" class="w-3.5 h-3.5 text-slate-500" />
+ <span data-github-forks>--</span>
+ </span>
+ </div>
+ </a>
<a
rel="noopener"
href={getLocalizedPath(locale, "/blog/ai-agent-deploy-cloudflare")}
@@ -128,25 +137,6 @@ const copy = siteCopy[locale].hero;
<span>{locale === "en-US" ? "Clipper" : "剪藏插件"}</span>
</a>
</div>
-
- <!-- Product Hunt Pre-Launch Badge -->
- <div class="mt-4 flex items-center">
- <a
- href="https://www.producthunt.com/products/edgeever?launch=edgeever&utm_source=badge-featured&utm_medium=badge&utm_campaign=edgeever"
- target="_blank"
- rel="noopener"
- class="inline-block transition-transform duration-300 hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 rounded-xl"
- >
- <img
- src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=edgeever&theme=neutral"
- alt="EdgeEver - Your open-source, AI-native Evernote alternative | Product Hunt"
- style="width: 250px; height: 54px;"
- width="250"
- height="54"
- loading="lazy"
- />
- </a>
- </div>
</div>
</div>
@@ -202,3 +192,64 @@ const copy = siteCopy[locale].hero;
sans-serif;
}
</style>
+
+<script is:inline>
+ (function () {
+ function formatCount(count) {
+ if (typeof count !== "number") return String(count);
+ if (count >= 1000) {
+ return (count / 1000).toFixed(1).replace(/\.0$/, "") + "k";
+ }
+ return count.toLocaleString();
+ }
+
+ async function fetchGitHubStats() {
+ var starEls = document.querySelectorAll("[data-github-stars]");
+ var forkEls = document.querySelectorAll("[data-github-forks]");
+ if (!starEls.length && !forkEls.length) return;
+
+ // 1. Direct real-time fetch from GitHub API (always fresh, no cache)
+ try {
+ var res = await fetch("https://api.github.com/repos/tianma-if/edgeever", {
+ headers: { Accept: "application/vnd.github.v3+json" },
+ cache: "no-store",
+ });
+ if (res.ok) {
+ var data = await res.json();
+ if (typeof data.stargazers_count === "number") {
+ starEls.forEach(function (el) { el.textContent = formatCount(data.stargazers_count); });
+ }
+ if (typeof data.forks_count === "number") {
+ forkEls.forEach(function (el) { el.textContent = formatCount(data.forks_count); });
+ }
+ return;
+ }
+ } catch (e) {
+ // Fall back to Shields live JSON endpoint if GitHub API is unavailable/rate-limited
+ }
+
+ // 2. Fallback: Shields.io live JSON API (same data source as Readme badges)
+ try {
+ var responses = await Promise.all([
+ fetch("https://img.shields.io/github/stars/tianma-if/edgeever.json", { cache: "no-store" }),
+ fetch("https://img.shields.io/github/forks/tianma-if/edgeever.json", { cache: "no-store" }),
+ ]);
+ if (responses[0].ok) {
+ var sData = await responses[0].json();
+ var sVal = sData.value || sData.message;
+ if (sVal) starEls.forEach(function (el) { el.textContent = sVal; });
+ }
+ if (responses[1].ok) {
+ var fData = await responses[1].json();
+ var fVal = fData.value || fData.message;
+ if (fVal) forkEls.forEach(function (el) { el.textContent = fVal; });
+ }
+ } catch (e) {
+ // Ignore fallback errors
+ }
+ }
+
+ fetchGitHubStats();
+ document.addEventListener("astro:page-load", fetchGitHubStats);
+ })();
+</script>
diff --git a/apps/site/src/components/navbar/navbar.astro b/apps/site/src/components/navbar/navbar.astro
index b1a1e886..18b62f3f 100644
--- a/apps/site/src/components/navbar/navbar.astro
+++ b/apps/site/src/components/navbar/navbar.astro
@@ -88,37 +88,56 @@ const menuitems = [
</ul>
</nav>
- <!-- Desktop Actions Right -->
- <div class="hidden lg:flex items-center gap-3">
- <LanguageSwitcher pathname={Astro.url.pathname} />
+ <!-- Actions & Hamburger Right -->
+ <div class="flex items-center gap-2 sm:gap-3">
<a
- href="https://github.com/tianma-if/edgeever"
+ href="https://www.producthunt.com/products/edgeever?launch=edgeever&utm_source=badge-featured&utm_medium=badge&utm_campaign=edgeever"
target="_blank"
rel="noopener"
- class="inline-flex items-center gap-1.5 px-3.5 py-1.5 text-xs font-semibold text-slate-700 hover:text-slate-900 bg-white hover:bg-slate-50 border border-slate-200/90 hover:border-slate-300 rounded-full transition-all duration-200 shadow-2xs"
- aria-label="GitHub"
+ class="inline-flex items-center transition-transform duration-200 hover:-translate-y-0.5 shrink-0"
>
- <Icon class="h-4 w-4 text-slate-800" name="bx:bxl-github" />
- <span>{copy.openSource}</span>
+ <img
+ src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=edgeever&theme=neutral"
+ alt="EdgeEver on Product Hunt"
+ style="width: 120px; height: 26px;"
+ width="120"
+ height="26"
+ loading="lazy"
+ />
</a>
- </div>
- <!-- Mobile Hamburger Toggle Button -->
- <button
- type="button"
- id="mobile-nav-toggle"
- aria-label="Toggle mobile menu"
- aria-controls="mobile-nav-menu"
- aria-expanded="false"
- class="lg:hidden min-h-11 min-w-11 p-2 rounded-xl border border-slate-200/80 bg-white/90 text-slate-700 hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 focus-visible:ring-offset-2 transition-colors"
- >
- <svg id="hamburger-icon" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
- <path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
- </svg>
- <svg id="close-icon" class="w-5 h-5 hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
- </svg>
- </button>
+ <!-- Desktop Only Items -->
+ <div class="hidden lg:flex items-center gap-3">
+ <LanguageSwitcher pathname={Astro.url.pathname} />
+ <a
+ href="https://github.com/tianma-if/edgeever"
+ target="_blank"
+ rel="noopener"
+ class="inline-flex items-center gap-1.5 px-3.5 py-1.5 text-xs font-semibold text-slate-700 hover:text-slate-900 bg-white hover:bg-slate-50 border border-slate-200/90 hover:border-slate-300 rounded-full transition-all duration-200 shadow-2xs"
+ aria-label="GitHub"
+ >
+ <Icon class="h-4 w-4 text-slate-800" name="bx:bxl-github" />
+ <span>{copy.openSource}</span>
+ </a>
+ </div>
+
+ <!-- Mobile Hamburger Toggle Button -->
+ <button
+ type="button"
+ id="mobile-nav-toggle"
+ aria-label="Toggle mobile menu"
+ aria-controls="mobile-nav-menu"
+ aria-expanded="false"
+ class="lg:hidden min-h-11 min-w-11 p-2 rounded-xl border border-slate-200/80 bg-white/90 text-slate-700 hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 focus-visible:ring-offset-2 transition-colors"
+ >
+ <svg id="hamburger-icon" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
+ </svg>
+ <svg id="close-icon" class="w-5 h-5 hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
+ </svg>
+ </button>
+ </div>
</div>
<!-- Mobile Navigation Drawer -->