Skip to content

Commit b48ce2f

Browse files
committed
enhance ProviderPage layout and SEO content; update SearchClientComponent to extract providerSlug from URL
1 parent df2db87 commit b48ce2f

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

app/apis/[providerSlug]/page.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,37 @@ export default async function ProviderPage({
110110

111111
const services = apis.filter((api) => api.serviceName);
112112
if (services.length > 0) {
113+
const providerName = apis[0]?.providerName || providerSlug;
113114
return (
114-
<div className=" mx-auto px-4 relative">
115-
<SearchClientComponent providerSlug={providerSlug} />
115+
<div className="min-h-screen ">
116+
<div className="bg-white">
117+
<div className="container mx-auto px-4 py-12">
118+
<div className="text-center">
119+
<h1 className="text-5xl md:text-6xl font-bold text-gray-900 mb-6">
120+
{providerName} <span className="text-primary">APIs</span>
121+
</h1>
122+
<p className="text-xl text-gray-600 max-w-4xl mx-auto mb-8">
123+
Discover and explore {services.length} API
124+
{services.length > 1 ? "s" : ""} from {providerName}. Access
125+
comprehensive documentation, endpoints, and integration guides
126+
to power your applications.
127+
</p>
128+
<div className="flex flex-wrap justify-center gap-4">
129+
<div className="bg-indigo-100 text-secondary px-6 py-3 rounded-full">
130+
<span className="font-semibold text-lg">
131+
{services.length} Service{services.length > 1 ? "s" : ""}{" "}
132+
Available
133+
</span>
134+
</div>
135+
</div>
136+
</div>
137+
</div>
138+
</div>
139+
140+
{/* Main Content */}
141+
<div className="container mx-auto px-4 py-8">
142+
<SearchClientComponent providerSlug={providerSlug} />
143+
</div>
116144
</div>
117145
);
118146
} else {

components/SearchClientComponent.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,19 @@ const routing = {
2727
};
2828
},
2929
routeToState(routeState: any) {
30+
// Extract providerSlug from pathname if available
31+
let providerSlug = "";
32+
if (typeof window !== "undefined") {
33+
const pathSegments = window.location.pathname.split("/");
34+
const apisIndex = pathSegments.indexOf("apis");
35+
if (apisIndex !== -1 && pathSegments[apisIndex + 1]) {
36+
providerSlug = pathSegments[apisIndex + 1];
37+
}
38+
}
39+
3040
return {
3141
[indexName]: {
32-
query: routeState.query || "",
42+
query: providerSlug || routeState.query || "",
3343
},
3444
};
3545
},
@@ -53,7 +63,7 @@ function SearchClientComponentInner({
5363
searchClient={searchClient}
5464
routing={routing}
5565
>
56-
<SearchSection />
66+
{!providerSlug && <SearchSection />}
5767

5868
<ApiGrid gridColumns={gridColumns} pageSize={pageSize} />
5969
</InstantSearchNext>

components/Support.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export default function Support({
3232
className="mx-auto"
3333
/>
3434
</div>
35-
<h2 className="text-2xl md:text-3xl font-bold text-gray-800 leading-tight">
35+
<h1 className="text-2xl md:text-3xl font-bold text-gray-800 leading-tight">
3636
Wikipedia for Web APIs. Directory of REST API definitions.
37-
</h2>
37+
</h1>
3838
</div>
3939
</div>
4040

0 commit comments

Comments
 (0)