@lynx-seo/engine 3.3.4 → 3.3.5

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 CHANGED
@@ -194,10 +194,62 @@ const pageStandard = matrixEngine.resolvePage(["commercial-hvac", "new-york"], "
194
194
  const pageCustom = matrixEngine.resolvePage(["commercial-hvac", "90210"], "https://example.com", PSEO_DATASET, SEO_CONFIG);
195
195
  ```
196
196
 
197
- ### 3. Edge GeoIP Resolution Example
197
+ ### 3. Universal Web Middleware & Framework Handlers
198
+
199
+ Plug dynamic sitemaps, AI bot directives (`/llms.txt`, `/robots.txt`), and non-blocking traffic tracking in 1 line:
200
+
201
+ #### Express / Connect / Polka:
202
+ ```typescript
203
+ import express from "express";
204
+ import { LynxSeoEngine, expressMiddleware } from "@lynx-seo/engine";
205
+
206
+ const app = express();
207
+ const engine = new LynxSeoEngine({ apiKey: process.env.LYNXSEO_API_KEY });
208
+
209
+ // Plugs /sitemap-pseo.xml, /llms.txt, /robots.txt and auto-tracking
210
+ app.use(expressMiddleware(engine));
211
+ ```
212
+
213
+ #### Next.js App Router (`app/sitemap-pseo.xml/route.ts` & `app/llms.txt/route.ts`):
214
+ ```typescript
215
+ import { LynxSeoEngine, createNextRouteHandler } from "@lynx-seo/engine";
216
+
217
+ const engine = new LynxSeoEngine({ apiKey: process.env.LYNXSEO_API_KEY });
218
+ export const { GET } = createNextRouteHandler(engine);
219
+ ```
220
+
221
+ #### Hono / Cloudflare Workers:
222
+ ```typescript
223
+ import { Hono } from "hono";
224
+ import { LynxSeoEngine, webFetchHandler } from "@lynx-seo/engine";
225
+
226
+ const app = new Hono();
227
+ const engine = new LynxSeoEngine({ apiKey: process.env.LYNXSEO_API_KEY });
228
+ const handleFetch = webFetchHandler(engine);
229
+
230
+ app.use("*", async (c, next) => {
231
+ const res = await handleFetch(c.req.raw);
232
+ if (res) return res;
233
+ await next();
234
+ });
235
+ ```
236
+
237
+ #### Next.js Metadata Helper (`toNextMetadata`):
238
+ ```typescript
239
+ import { toNextMetadata, LynxSeoEngine } from "@lynx-seo/engine";
240
+
241
+ export async function generateMetadata({ params }) {
242
+ const page = engine.resolve({ service: params.service, location: params.city });
243
+ return toNextMetadata(page);
244
+ }
245
+ ```
246
+
247
+ ---
248
+
249
+ ### 4. Edge GeoIP Resolution Example
198
250
 
199
251
  ```typescript
200
- import { resolveLocationFromHeaders, PseoMatrixEngine } from "@lynxseo/engine";
252
+ import { resolveLocationFromHeaders, PseoMatrixEngine } from "@lynx-seo/engine";
201
253
 
202
254
  export function handleIncomingRequest(request: Request) {
203
255
  const geo = resolveLocationFromHeaders(request.headers);