Internal Linking Optimizer
Run ID: 69c955d8a17964d77e86e11a2026-03-29SEO
PantheraHive BOS
BOS Dashboard

Map site structure and generate optimal internal linking strategy with anchor text suggestions.

This document outlines the comprehensive strategy for optimizing your site's internal linking structure. This is Step 1 of 2 in the "Internal Linking Optimizer" workflow, focusing on mapping your site's architecture and developing a robust strategy with actionable anchor text suggestions.


Internal Linking Optimizer: Step 1 - Strategy Generation

I. Introduction & Objective

The primary objective of this deliverable is to establish a foundational understanding of your website's current structure and to define an optimal internal linking strategy. A well-executed internal linking strategy is crucial for enhancing search engine visibility, improving user experience, distributing "link equity" (PageRank) effectively across your site, and increasing the crawlability and indexability of your content.

This step generates a detailed framework and set of principles that will guide the subsequent, more granular recommendations in Step 2, which will involve specific link placement and anchor text suggestions tailored to your actual site data.

II. Site Structure Mapping Methodology

To develop an effective internal linking strategy, we first need a clear and accurate map of your website's current architecture.

1. Required Inputs for Mapping

To accurately map your site structure, we would require the following data from your end:

  • XML Sitemap(s): The most up-to-date XML sitemaps for your entire domain.
  • Full URL List/Content Inventory: A comprehensive list of all live URLs on your site, ideally categorized by content type (e.g., blog posts, product pages, category pages, service pages, static pages).
  • Analytics Access (Optional but Recommended): Read-only access to Google Analytics or similar analytics platform to understand page performance, user flow, and identify key "hub" pages.
  • Search Console Access (Optional but Recommended): Read-only access to Google Search Console for insights into indexation status, crawl errors, and top-performing queries.
  • Current Site Navigation Structure: Details on your main navigation, footer navigation, and any sidebar navigation elements.

2. Our Mapping Process

Upon receiving the necessary inputs, our process will involve:

  • Crawling & Data Collection: Utilizing advanced crawling tools to simulate search engine behavior and gather data on all accessible URLs, their hierarchy, and existing internal links.
  • URL Segmentation & Categorization: Grouping URLs into logical content clusters (e.g., "Pillar Content," "Supporting Articles," "Product Categories," "Individual Products," "Service Areas").
  • Hierarchy Identification: Determining the depth of pages from the homepage and identifying parent-child relationships.
  • Visual Representation: Creating a visual site map (e.g., a tree structure, mind map, or spreadsheet-based hierarchical view) to clearly illustrate the current architecture.
  • Identifying Key Hubs & Spokes: Pinpointing existing high-authority pages (hubs) and related supporting content (spokes).
  • Analyzing Link Equity Flow: Assessing how link equity currently flows through your site and identifying any "dead ends" or under-linked important pages.

3. Expected Outputs of Site Structure Mapping

The output will be a comprehensive understanding and representation of your site structure, highlighting:

  • Hierarchical Breakdown: A clear view of your site's depth and organization.
  • Content Clusters: Identification of topical silos and content groups.
  • Key Pages: Identification of high-value pages, including pillar content, category pages, and conversion-focused pages.
  • Structural Gaps/Opportunities: Areas where the structure could be improved for better SEO and UX.

III. Core Principles of Optimal Internal Linking

An effective internal linking strategy is built upon several core principles:

  1. Relevance: Links should always connect topically related content. A link from an article about "dog training tips" to a product page for "dog food" might be less relevant than linking to an article about "best dog breeds for training."
  2. Authority Distribution (Link Equity Flow): Internal links pass "link equity" (PageRank). High-authority pages should strategically link to important lower-authority pages to boost their visibility.
  3. User Experience (UX): Links should guide users naturally through the site, helping them find related information or complete desired actions. They should be intuitive and enhance the user journey.
  4. Crawlability & Indexability: Internal links act as pathways for search engine bots. A strong internal link structure ensures that all important pages are easily discoverable and indexed.
  5. Anchor Text Diversity & Specificity: Anchor text should be descriptive, relevant to the target page, and varied to avoid over-optimization penalties while providing context to both users and search engines.
  6. Avoid Orphan Pages: Every important page should have at least one internal link pointing to it. Orphan pages (pages with no incoming internal links) are difficult for search engines to discover.
  7. Minimize Click Depth: Important pages (especially conversion-focused ones) should be reachable within 2-3 clicks from the homepage.

IV. Proposed Internal Linking Strategy Framework

Based on the site structure mapping and core principles, we will develop a strategy utilizing several linking types:

1. Hierarchical Linking

  • Purpose: Establishes clear parent-child relationships and defines the site's main categories and subcategories.
  • Implementation:

* Main Navigation: Links from the homepage to primary category pages, and from primary categories to subcategories.

* Breadcrumbs: Implement breadcrumb navigation on all relevant pages (e.g., Home > Category > Subcategory > Product). This provides clear navigational cues and internal links.

* Parent-Child Links: Category pages linking to individual product/service pages, and product/service pages linking back to their parent category.

2. Contextual Linking

  • Purpose: Connects topically related content within the body of articles or pages, enhancing relevance and user journey.
  • Implementation:

* Within Blog Posts/Articles: Link from relevant keywords or phrases within one article to another related article, a product page, or a service page.

* "Related Posts" / "Further Reading" Sections: Dynamically generated or manually curated links to relevant content at the end of articles.

* Product/Service Page Descriptions: Link to related blog posts, FAQs, or other product/service pages that complement the current offering.

3. Siloing / Topical Clustering

  • Purpose: To reinforce the topical authority of specific content clusters by ensuring that pages within a silo primarily link to other pages within that same silo, with limited outbound links to other silos.
  • Implementation:

* Pillar Pages: Identify or create comprehensive "pillar pages" that cover a broad topic. These pages will link out to numerous, more specific "cluster content" articles.

* Cluster Content: Each supporting article in a cluster will link back to its respective pillar page and may link to other closely related articles within the same cluster.

* Category Pages as Silo Hubs: Category pages can serve as pillar pages, linking down to all products/services within that category, and those products/services linking back up.

4. Hub-and-Spoke Model

  • Purpose: A specific application of siloing, where a central "hub" page (e.g., a comprehensive guide or pillar page) links out to multiple "spoke" pages (detailed articles on sub-topics), and the spoke pages link back to the hub.
  • Implementation:

* Identify Hubs: High-value, comprehensive content pieces that can serve as central reference points.

* Map Spokes: Identify all supporting content that elaborates on specific aspects of the hub topic.

* Strategic Linking: Ensure the hub links to all spokes, and each spoke links back to the hub.

5. Navigational Linking

  • Purpose: Ensures essential pages are easily accessible from any point on the site.
  • Implementation:

* Main Navigation: Prioritize key category pages, service pages, and "about us" / "contact us" pages.

* Footer Navigation: Include links to legal pages (privacy policy, terms of service), contact information, sitemap, and potentially secondary category links.

6. Link Depth Optimization

  • Purpose: Ensures that all important pages are within an optimal click-depth from the homepage, typically 2-3 clicks.
  • Implementation:

* Prioritize High-Value Pages: Ensure conversion-focused pages, pillar content, and key category pages are linked prominently from the homepage or main navigation.

* Review Deep Pages: Identify pages that are more than 3 clicks deep and determine if they can be brought closer to the surface through strategic internal linking.

V. Anchor Text Strategy & Suggestions

Anchor text is the clickable text in a hyperlink. It provides context about the destination page to both users and search engines.

1. Best Practices for Anchor Text

  • Descriptive & Relevant: The anchor text should accurately describe the content of the linked page.
  • Concise: Keep anchor text brief, usually 2-5 words.
  • Natural & Varied: Avoid using the exact same anchor text repeatedly for the same target page, as this can appear spammy. Use variations and synonyms.
  • Avoid Generic Phrases: Do not use generic phrases like "click here," "read more," or "learn more" as anchor text. These provide no context.
  • User-Friendly: Anchor text should make sense in the context of the surrounding sentence and encourage clicks.
  • Keyword Integration (Subtly): While relevant, avoid keyword stuffing in anchor text. Integrate target keywords naturally when appropriate.

2. Types of Anchor Text

We will recommend a mix of anchor text types to maintain a natural profile:

  • Exact Match: Uses the exact target keyword for the linked page. (Use sparingly)

Example:* Learn about our organic coffee beans.

  • Partial Match: Includes a variation or part of the target keyword.

Example:* Discover the best coffee bean varieties.

  • Branded: Uses your brand name.

Example:* Explore more options on the PantheraHive website.

  • Naked URL: Uses the URL itself as the anchor text. (Less common for internal links but can occur naturally).

Example:* For more details, visit https://www.example.com/coffee-beans.

  • Generic: Phrases like "read more" (to be avoided as primary strategy).
  • Long-tail/Phrase Match: Uses a longer, more descriptive phrase.

Example:* Read our comprehensive guide on how to brew the perfect cup of coffee at home.

3. Anchor Text Generation Process

For each identified linking opportunity, we will:

  1. Analyze Source Page Content: Understand the context from which the link originates.
  2. Identify Target Page Keywords: Determine the primary and secondary keywords the target page is optimized for.
  3. Assess User Intent: What information is the user likely seeking when clicking this link?
  4. Propose Varied Options: Provide 2-3 suitable anchor text suggestions for each link, prioritizing relevance, context, and natural language.

Example Anchor Text Suggestions (Hypothetical Scenario: Coffee Blog)

| Source Page Content | Target Page (URL/Topic) | Anchor Text Suggestions |

| :--------------------------------------------------- | :------------------------------------ | :------------------------------------------------------------------------------------------------------------------------- |

| "...our article on different brewing methods..." | /blog/brewing-methods | "different brewing methods", "coffee brewing techniques", "master your brew" |

| "...for a deeper dive into espresso machines..." | /products/espresso-machines | "espresso machines", "best espresso makers", "high-quality espresso machines" |

| "...the origins of Arabica coffee beans..." | /blog/arabica-vs-robusta | "Arabica coffee beans", "learn about Arabica", "Arabica coffee bean characteristics" |

| "...explore our single-origin coffees..." | /category/single-origin-coffee | "single-origin coffees", "premium single-origin beans", "our selection of single-origin coffee" |

| "...tips for storing coffee properly..." | /blog/coffee-storage-tips | "storing coffee properly", "best coffee storage methods", "how to store your coffee" |

VI. Next Steps & Required Inputs for Step 2

This deliverable provides the strategic blueprint for your internal linking. To move forward with Step 2: Specific Recommendations & Implementation Plan, we will require your feedback and confirmation on this strategy.

Once approved, we will proceed to:

  1. Detailed Link Audits: Conduct a deep dive into your existing internal links.
  2. Specific Link Recommendations: Generate a prioritized list of exact URLs to link from and to, along with precise anchor text suggestions for each. This will include identifying new linking opportunities and optimizing existing ones.
  3. Implementation Guidelines: Provide clear instructions for implementing the recommended changes, including technical considerations if applicable.
  4. Monitoring & Reporting Plan: Outline how we will track the performance of these changes.

Your partnership in providing the necessary inputs and feedback is crucial for a successful optimization.

gemini Output

Internal Linking Strategy: Site Structure Mapping & Optimization

This document outlines a comprehensive internal linking strategy designed to enhance your website's search engine optimization (SEO), improve user experience, and distribute PageRank effectively across your site. We have mapped a representative site structure and developed actionable recommendations for optimal internal linking and anchor text usage.


Executive Summary

An effective internal linking strategy is crucial for guiding both users and search engine crawlers through your website. It helps establish topical authority, improves crawlability, and passes SEO value (PageRank) between pages. This strategy focuses on building a robust, hierarchical, and contextually relevant link architecture, ensuring that important pages receive appropriate visibility and authority.


1. Site Structure Mapping (Hypothetical Example)

To illustrate an optimal internal linking strategy, we have mapped a typical, well-structured website hierarchy. While specific URLs and content will vary for your actual site, this example provides a foundational model that can be adapted.

Hypothetical Site Structure: "Outdoor Adventures Gear"

This structure represents a common e-commerce or content-rich website, emphasizing clear categories, subcategories, product/service pages, and a robust content hub.

  • Homepage (/)

* Main Categories (/category/)

* Camping & Hiking (/camping-hiking/)

* Subcategory: Tents (/camping-hiking/tents/)

* Product Page: Ultralight Tent X (/camping-hiking/tents/ultralight-tent-x/)

* Product Page: Family Tent Y (/camping-hiking/tents/family-tent-y/)

* Subcategory: Sleeping Bags (/camping-hiking/sleeping-bags/)

* Product Page: Down Sleeping Bag A (/camping-hiking/sleeping-bags/down-sleeping-bag-a/)

* Resource Article: "Choosing Your First Backpacking Tent" (/blog/first-backpacking-tent-guide/)

* Resource Article: "Beginner's Guide to Overnight Hikes" (/blog/beginner-overnight-hikes/)

* Climbing Gear (/climbing-gear/)

* Subcategory: Ropes (/climbing-gear/ropes/)

* Product Page: Dynamic Climbing Rope Z (/climbing-gear/ropes/dynamic-rope-z/)

* Subcategory: Harnesses (/climbing-gear/harnesses/)

* Product Page: Sport Climbing Harness B (/climbing-gear/harnesses/sport-harness-b/)

* Resource Article: "Essential Rock Climbing Safety Tips" (/blog/climbing-safety-tips/)

* Water Sports (/water-sports/)

* Subcategory: Kayaks (/water-sports/kayaks/)

* Product Page: Inflatable Kayak C (/water-sports/kayaks/inflatable-kayak-c/)

* Subcategory: Paddleboards (/water-sports/paddleboards/)

* Product Page: Touring SUP D (/water-sports/paddleboards/touring-sup-d/)

* Resource Article: "Kayak Buying Guide for Beginners" (/blog/kayak-buying-guide/)

* Blog/Resources Hub (/blog/)

* Pillar Content: "Ultimate Guide to Outdoor Adventures" (/blog/ultimate-outdoor-guide/)

* Cluster Article: "Best Lightweight Backpacks for Thru-Hiking" (/blog/best-lightweight-backpacks/)

* Cluster Article: "How to Pack for a Multi-Day Hike" (/blog/how-to-pack-multi-day-hike/)

* All other resource articles listed above.

* About Us (/about-us/)

* Contact Us (/contact/)

* FAQ (/faq/)

Node Types Explained:

  • Homepage: The central entry point, distributing authority broadly.
  • Main Categories: Broad topics, linking to subcategories and key articles.
  • Subcategories: Niche topics, linking to specific products and relevant articles.
  • Product/Service Pages: End-point pages, often linking to related products or informational content.
  • Blog/Resources Hub: A central directory for all informational content.
  • Pillar Content: Comprehensive guides on a broad topic, linking to many related "cluster" articles.
  • Cluster Articles: Detailed pieces on specific aspects of a pillar topic, linking back to the pillar.
  • Static Pages (About, Contact, FAQ): Essential informational pages.

2. Principles of Optimal Internal Linking

An effective internal linking strategy adheres to the following core principles:

  • Hierarchy Reinforcement: Links should generally follow and reinforce the logical structure of your site, guiding users and crawlers from broader topics to more specific ones, and vice-versa.
  • Topical Authority: Link related content together to establish your website as an authority on specific subjects. This helps search engines understand the relationships between your pages.
  • User Experience (UX): Links should be intuitive and helpful, guiding users to relevant information or products they might be interested in, reducing bounce rates, and increasing time on site.
  • PageRank Distribution: Internal links help distribute "link equity" or "PageRank" from authoritative pages (like your homepage or high-performing articles) to other important pages deeper within your site.
  • Crawlability & Indexation: A well-linked site ensures that search engine bots can easily discover and index all your important pages. Orphaned pages (pages with no internal links pointing to them) are often missed.
  • Keyword Relevance: Anchor text used for internal links should be descriptive and include relevant keywords, signaling the topic of the linked page to search engines.

3. Recommended Internal Linking Strategy

This strategy is divided into foundational site-wide linking and contextual, content-specific linking.

3.1. Foundational Linking (Site-wide Navigation)

These links are consistent across most or all pages and form the backbone of your site's structure.

  • Global Navigation (Header Menu):

* Purpose: Primary entry points for users and crawlers, distributing initial PageRank.

* Implementation: Link from the homepage to all main categories (/camping-hiking/, /climbing-gear/, /water-sports/), and to the Blog/Resources Hub, About Us, and Contact Us pages. Each main category page should also be linked from this menu.

* Example:

* HomepageCamping & Hiking

* HomepageClimbing Gear

* HomepageWater Sports

* HomepageBlog

* HomepageAbout Us

  • Breadcrumbs:

* Purpose: Show the user's current location within the site hierarchy, providing quick navigation back up the chain and reinforcing site structure for crawlers.

* Implementation: Implement on all subcategory, product, and blog article pages. Use structured data (Schema.org BreadcrumbList) for enhanced SEO.

* Example:

* Homepage > Camping & Hiking > Tents > Ultralight Tent X

* Homepage > Blog > Ultimate Guide to Outdoor Adventures

  • Footer Navigation:

* Purpose: Links to essential but less frequently accessed pages (e.g., legal, customer service, sitemap).

* Implementation: Include links to Privacy Policy, Terms of Service, Shipping Information, Returns, FAQ, and an HTML Sitemap.

* Example:

* All PagesPrivacy Policy (in footer)

* All PagesHTML Sitemap (in footer)

  • HTML Sitemap:

* Purpose: A human-readable list of all important pages on your site, ensuring comprehensive crawlability.

* Implementation: Create a dedicated HTML sitemap page, linked from the footer.

3.2. Contextual Linking (Content-Specific)

These links are embedded within the body of your content and are critical for establishing topical relevance and distributing PageRank effectively.

  • From Blog/Resource Pages to Product/Category Pages:

* Purpose: Drive traffic from informational content to commercial pages, signaling relevance and converting users.

* Implementation: When discussing products or categories within a blog post, link directly to the relevant product or category page.

* Example:

* From "Choosing Your First Backpacking Tent" (/blog/first-backpacking-tent-guide/) → "Tents" category page (/camping-hiking/tents/) and specific product pages like "Ultralight Tent X" (/camping-hiking/tents/ultralight-tent-x/).

* From "Kayak Buying Guide for Beginners" (/blog/kayak-buying-guide/) → "Kayaks" category page (/water-sports/kayaks/).

  • From Product/Category Pages to Blog/Resource Pages:

* Purpose: Provide additional value to users, answer common questions, and demonstrate expertise, improving user engagement and reducing bounce rate.

* Implementation: Include a "Related Guides" or "Learn More" section on product and category pages.

* Example:

* From "Ultralight Tent X" product page (/camping-hiking/tents/ultralight-tent-x/) → "Choosing Your First Backpacking Tent" (/blog/first-backpacking-tent-guide/).

* From "Kayaks" category page (/water-sports/kayaks/) → "Kayak Buying Guide for Beginners" (/blog/kayak-buying-guide/).

  • Between Related Blog/Resource Pages (Pillar/Cluster Model):

* Purpose: Build strong topical authority by interlinking deeply related content. The pillar page acts as a central hub for a broad topic.

* Implementation:

* Pillar Page to Cluster Pages: The "Ultimate Guide to Outdoor Adventures" pillar page should link to all its related cluster articles (e.g., "Best Lightweight Backpacks," "How to Pack for a Multi-Day Hike").

* Cluster Pages to Pillar Page: Each cluster article should link back to the main pillar page, using relevant anchor text.

* Cluster Pages to Cluster Pages: Link between highly relevant cluster articles where appropriate.

* Example:

* From "Ultimate Guide to Outdoor Adventures" (/blog/ultimate-outdoor-guide/) → "Best Lightweight Backpacks for Thru-Hiking" (/blog/best-lightweight-backpacks/).

* From "Best Lightweight Backpacks for Thru-Hiking" (/blog/best-lightweight-backpacks/) → "Ultimate Guide to Outdoor Adventures" (/blog/ultimate-outdoor-guide/).

* From "Best Lightweight Backpacks for Thru-Hiking" (/blog/best-lightweight-backpacks/) → "How to Pack for a Multi-Day Hike" (/blog/how-to-pack-multi-day-hike/).

  • Between Related Product/Category Pages:

* Purpose: Facilitate cross-selling, up-selling, and user exploration of related offerings.

* Implementation: Use "Customers also bought," "Related Products," or "Complementary Gear" sections.

* Example:

* From "Ultralight Tent X" (/camping-hiking/tents/ultralight-tent-x/) → "Down Sleeping Bag A" (/camping-hiking/sleeping-bags/down-sleeping-bag-a/) or "Backpacks" category (/camping-hiking/backpacks/).

3.3. Automated Linking Opportunities

  • Related Products/Posts Sections: Implement dynamic sections using algorithms to suggest relevant content based on user behavior or categorization.
  • XML Sitemap: Ensure an up-to-date XML sitemap is submitted to Google Search Console to aid crawler discovery. While not an internal link in the traditional sense, it's crucial for indexation.

4. Anchor Text Strategy & Suggestions

Anchor text is the clickable text in a hyperlink

Copy all content
Full output as text
Download ZIP
IDE-ready project ZIP
Copy share link
Permanent URL for this run
Get Embed Code
Embed this result on any website
Print / Save PDF
Use browser print dialog
\n\n\n"); var hasSrcMain=Object.keys(extracted).some(function(k){return k.indexOf("src/main")>=0;}); if(!hasSrcMain) zip.file(folder+"src/main."+ext,"import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './App'\nimport './index.css'\n\nReactDOM.createRoot(document.getElementById('root')!).render(\n \n \n \n)\n"); var hasSrcApp=Object.keys(extracted).some(function(k){return k==="src/App."+ext||k==="App."+ext;}); if(!hasSrcApp) zip.file(folder+"src/App."+ext,"import React from 'react'\nimport './App.css'\n\nfunction App(){\n return(\n
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n
\n )\n}\nexport default App\n"); zip.file(folder+"src/index.css","*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#f0f2f5;color:#1a1a2e}\n.app{min-height:100vh;display:flex;flex-direction:column}\n.app-header{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px}\nh1{font-size:2.5rem;font-weight:700}\n"); zip.file(folder+"src/App.css",""); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/pages/.gitkeep",""); zip.file(folder+"src/hooks/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\n## Open in IDE\nOpen the project folder in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- Vue (Vite + Composition API + TypeScript) --- */ function buildVue(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "type": "module",\n "scripts": {\n "dev": "vite",\n "build": "vue-tsc -b && vite build",\n "preview": "vite preview"\n },\n "dependencies": {\n "vue": "^3.5.13",\n "vue-router": "^4.4.5",\n "pinia": "^2.3.0",\n "axios": "^1.7.9"\n },\n "devDependencies": {\n "@vitejs/plugin-vue": "^5.2.1",\n "typescript": "~5.7.3",\n "vite": "^6.0.5",\n "vue-tsc": "^2.2.0"\n }\n}\n'); zip.file(folder+"vite.config.ts","import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport { resolve } from 'path'\n\nexport default defineConfig({\n plugins: [vue()],\n resolve: { alias: { '@': resolve(__dirname,'src') } }\n})\n"); zip.file(folder+"tsconfig.json",'{"files":[],"references":[{"path":"./tsconfig.app.json"},{"path":"./tsconfig.node.json"}]}\n'); zip.file(folder+"tsconfig.app.json",'{\n "compilerOptions":{\n "target":"ES2020","useDefineForClassFields":true,"module":"ESNext","lib":["ES2020","DOM","DOM.Iterable"],\n "skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true,\n "isolatedModules":true,"moduleDetection":"force","noEmit":true,"jsxImportSource":"vue",\n "strict":true,"paths":{"@/*":["./src/*"]}\n },\n "include":["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"]\n}\n'); zip.file(folder+"env.d.ts","/// \n"); zip.file(folder+"index.html","\n\n\n \n \n "+slugTitle(pn)+"\n\n\n
\n \n\n\n"); var hasMain=Object.keys(extracted).some(function(k){return k==="src/main.ts"||k==="main.ts";}); if(!hasMain) zip.file(folder+"src/main.ts","import { createApp } from 'vue'\nimport { createPinia } from 'pinia'\nimport App from './App.vue'\nimport './assets/main.css'\n\nconst app = createApp(App)\napp.use(createPinia())\napp.mount('#app')\n"); var hasApp=Object.keys(extracted).some(function(k){return k.indexOf("App.vue")>=0;}); if(!hasApp) zip.file(folder+"src/App.vue","\n\n\n\n\n"); zip.file(folder+"src/assets/main.css","*{margin:0;padding:0;box-sizing:border-box}body{font-family:system-ui,sans-serif;background:#fff;color:#213547}\n"); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/views/.gitkeep",""); zip.file(folder+"src/stores/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\nOpen in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- Angular (v19 standalone) --- */ function buildAngular(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var sel=pn.replace(/_/g,"-"); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "test": "ng test"\n },\n "dependencies": {\n "@angular/animations": "^19.0.0",\n "@angular/common": "^19.0.0",\n "@angular/compiler": "^19.0.0",\n "@angular/core": "^19.0.0",\n "@angular/forms": "^19.0.0",\n "@angular/platform-browser": "^19.0.0",\n "@angular/platform-browser-dynamic": "^19.0.0",\n "@angular/router": "^19.0.0",\n "rxjs": "~7.8.0",\n "tslib": "^2.3.0",\n "zone.js": "~0.15.0"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "^19.0.0",\n "@angular/cli": "^19.0.0",\n "@angular/compiler-cli": "^19.0.0",\n "typescript": "~5.6.0"\n }\n}\n'); zip.file(folder+"angular.json",'{\n "$schema": "./node_modules/@angular/cli/lib/config/schema.json",\n "version": 1,\n "newProjectRoot": "projects",\n "projects": {\n "'+pn+'": {\n "projectType": "application",\n "root": "",\n "sourceRoot": "src",\n "prefix": "app",\n "architect": {\n "build": {\n "builder": "@angular-devkit/build-angular:application",\n "options": {\n "outputPath": "dist/'+pn+'",\n "index": "src/index.html",\n "browser": "src/main.ts",\n "tsConfig": "tsconfig.app.json",\n "styles": ["src/styles.css"],\n "scripts": []\n }\n },\n "serve": {"builder":"@angular-devkit/build-angular:dev-server","configurations":{"production":{"buildTarget":"'+pn+':build:production"},"development":{"buildTarget":"'+pn+':build:development"}},"defaultConfiguration":"development"}\n }\n }\n }\n}\n'); zip.file(folder+"tsconfig.json",'{\n "compileOnSave": false,\n "compilerOptions": {"baseUrl":"./","outDir":"./dist/out-tsc","forceConsistentCasingInFileNames":true,"strict":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"paths":{"@/*":["src/*"]},"skipLibCheck":true,"esModuleInterop":true,"sourceMap":true,"declaration":false,"experimentalDecorators":true,"moduleResolution":"bundler","importHelpers":true,"target":"ES2022","module":"ES2022","useDefineForClassFields":false,"lib":["ES2022","dom"]},\n "references":[{"path":"./tsconfig.app.json"}]\n}\n'); zip.file(folder+"tsconfig.app.json",'{\n "extends":"./tsconfig.json",\n "compilerOptions":{"outDir":"./dist/out-tsc","types":[]},\n "files":["src/main.ts"],\n "include":["src/**/*.d.ts"]\n}\n'); zip.file(folder+"src/index.html","\n\n\n \n "+slugTitle(pn)+"\n \n \n \n\n\n \n\n\n"); zip.file(folder+"src/main.ts","import { bootstrapApplication } from '@angular/platform-browser';\nimport { appConfig } from './app/app.config';\nimport { AppComponent } from './app/app.component';\n\nbootstrapApplication(AppComponent, appConfig)\n .catch(err => console.error(err));\n"); zip.file(folder+"src/styles.css","* { margin: 0; padding: 0; box-sizing: border-box; }\nbody { font-family: system-ui, -apple-system, sans-serif; background: #f9fafb; color: #111827; }\n"); var hasComp=Object.keys(extracted).some(function(k){return k.indexOf("app.component")>=0;}); if(!hasComp){ zip.file(folder+"src/app/app.component.ts","import { Component } from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [RouterOutlet],\n templateUrl: './app.component.html',\n styleUrl: './app.component.css'\n})\nexport class AppComponent {\n title = '"+pn+"';\n}\n"); zip.file(folder+"src/app/app.component.html","
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n \n
\n"); zip.file(folder+"src/app/app.component.css",".app-header{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;gap:16px}h1{font-size:2.5rem;font-weight:700;color:#6366f1}\n"); } zip.file(folder+"src/app/app.config.ts","import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';\nimport { provideRouter } from '@angular/router';\nimport { routes } from './app.routes';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideZoneChangeDetection({ eventCoalescing: true }),\n provideRouter(routes)\n ]\n};\n"); zip.file(folder+"src/app/app.routes.ts","import { Routes } from '@angular/router';\n\nexport const routes: Routes = [];\n"); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nng serve\n# or: npm start\n\`\`\`\n\n## Build\n\`\`\`bash\nng build\n\`\`\`\n\nOpen in VS Code with Angular Language Service extension.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n.angular/\n"); } /* --- Python --- */ function buildPython(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/m,"").trim(); var reqMap={"numpy":"numpy","pandas":"pandas","sklearn":"scikit-learn","tensorflow":"tensorflow","torch":"torch","flask":"flask","fastapi":"fastapi","uvicorn":"uvicorn","requests":"requests","sqlalchemy":"sqlalchemy","pydantic":"pydantic","dotenv":"python-dotenv","PIL":"Pillow","cv2":"opencv-python","matplotlib":"matplotlib","seaborn":"seaborn","scipy":"scipy"}; var reqs=[]; Object.keys(reqMap).forEach(function(k){if(src.indexOf("import "+k)>=0||src.indexOf("from "+k)>=0)reqs.push(reqMap[k]);}); var reqsTxt=reqs.length?reqs.join("\n"):"# add dependencies here\n"; zip.file(folder+"main.py",src||"# "+title+"\n# Generated by PantheraHive BOS\n\nprint(title+\" loaded\")\n"); zip.file(folder+"requirements.txt",reqsTxt); zip.file(folder+".env.example","# Environment variables\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n\`\`\`\n\n## Run\n\`\`\`bash\npython main.py\n\`\`\`\n"); zip.file(folder+".gitignore",".venv/\n__pycache__/\n*.pyc\n.env\n.DS_Store\n"); } /* --- Node.js --- */ function buildNode(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/m,"").trim(); var depMap={"mongoose":"^8.0.0","dotenv":"^16.4.5","axios":"^1.7.9","cors":"^2.8.5","bcryptjs":"^2.4.3","jsonwebtoken":"^9.0.2","socket.io":"^4.7.4","uuid":"^9.0.1","zod":"^3.22.4","express":"^4.18.2"}; var deps={}; Object.keys(depMap).forEach(function(k){if(src.indexOf(k)>=0)deps[k]=depMap[k];}); if(!deps["express"])deps["express"]="^4.18.2"; var pkgJson=JSON.stringify({"name":pn,"version":"1.0.0","main":"src/index.js","scripts":{"start":"node src/index.js","dev":"nodemon src/index.js"},"dependencies":deps,"devDependencies":{"nodemon":"^3.0.3"}},null,2)+"\n"; zip.file(folder+"package.json",pkgJson); var fallback="const express=require(\"express\");\nconst app=express();\napp.use(express.json());\n\napp.get(\"/\",(req,res)=>{\n res.json({message:\""+title+" API\"});\n});\n\nconst PORT=process.env.PORT||3000;\napp.listen(PORT,()=>console.log(\"Server on port \"+PORT));\n"; zip.file(folder+"src/index.js",src||fallback); zip.file(folder+".env.example","PORT=3000\n"); zip.file(folder+".gitignore","node_modules/\n.env\n.DS_Store\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\n\`\`\`\n\n## Run\n\`\`\`bash\nnpm run dev\n\`\`\`\n"); } /* --- Vanilla HTML --- */ function buildVanillaHtml(zip,folder,app,code){ var title=slugTitle(app); var isFullDoc=code.trim().toLowerCase().indexOf("=0||code.trim().toLowerCase().indexOf("=0; var indexHtml=isFullDoc?code:"\n\n\n\n\n"+title+"\n\n\n\n"+code+"\n\n\n\n"; zip.file(folder+"index.html",indexHtml); zip.file(folder+"style.css","/* "+title+" — styles */\n*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#1a1a2e}\n"); zip.file(folder+"script.js","/* "+title+" — scripts */\n"); zip.file(folder+"assets/.gitkeep",""); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Open\nDouble-click \`index.html\` in your browser.\n\nOr serve locally:\n\`\`\`bash\nnpx serve .\n# or\npython3 -m http.server 3000\n\`\`\`\n"); zip.file(folder+".gitignore",".DS_Store\nnode_modules/\n.env\n"); } /* ===== MAIN ===== */ var sc=document.createElement("script"); sc.src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"; sc.onerror=function(){ if(lbl)lbl.textContent="Download ZIP"; alert("JSZip load failed — check connection."); }; sc.onload=function(){ var zip=new JSZip(); var base=(_phFname||"output").replace(/\.[^.]+$/,""); var app=base.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"my_app"; var folder=app+"/"; var vc=document.getElementById("panel-content"); var panelTxt=vc?(vc.innerText||vc.textContent||""):""; var lang=detectLang(_phCode,panelTxt); if(_phIsHtml){ buildVanillaHtml(zip,folder,app,_phCode); } else if(lang==="flutter"){ buildFlutter(zip,folder,app,_phCode,panelTxt); } else if(lang==="react-native"){ buildReactNative(zip,folder,app,_phCode,panelTxt); } else if(lang==="swift"){ buildSwift(zip,folder,app,_phCode,panelTxt); } else if(lang==="kotlin"){ buildKotlin(zip,folder,app,_phCode,panelTxt); } else if(lang==="react"){ buildReact(zip,folder,app,_phCode,panelTxt); } else if(lang==="vue"){ buildVue(zip,folder,app,_phCode,panelTxt); } else if(lang==="angular"){ buildAngular(zip,folder,app,_phCode,panelTxt); } else if(lang==="python"){ buildPython(zip,folder,app,_phCode); } else if(lang==="node"){ buildNode(zip,folder,app,_phCode); } else { /* Document/content workflow */ var title=app.replace(/_/g," "); var md=_phAll||_phCode||panelTxt||"No content"; zip.file(folder+app+".md",md); var h=""+title+""; h+="

"+title+"

"; var hc=md.replace(/&/g,"&").replace(//g,">"); hc=hc.replace(/^### (.+)$/gm,"

$1

"); hc=hc.replace(/^## (.+)$/gm,"

$1

"); hc=hc.replace(/^# (.+)$/gm,"

$1

"); hc=hc.replace(/\*\*(.+?)\*\*/g,"$1"); hc=hc.replace(/\n{2,}/g,"

"); h+="

"+hc+"

Generated by PantheraHive BOS
"; zip.file(folder+app+".html",h); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\nFiles:\n- "+app+".md (Markdown)\n- "+app+".html (styled HTML)\n"); } zip.generateAsync({type:"blob"}).then(function(blob){ var a=document.createElement("a"); a.href=URL.createObjectURL(blob); a.download=app+".zip"; a.click(); URL.revokeObjectURL(a.href); if(lbl)lbl.textContent="Download ZIP"; }); }; document.head.appendChild(sc); } function phShare(){navigator.clipboard.writeText(window.location.href).then(function(){var el=document.getElementById("ph-share-lbl");if(el){el.textContent="Link copied!";setTimeout(function(){el.textContent="Copy share link";},2500);}});}function phEmbed(){var runId=window.location.pathname.split("/").pop().replace(".html","");var embedUrl="https://pantherahive.com/embed/"+runId;var code='';navigator.clipboard.writeText(code).then(function(){var el=document.getElementById("ph-embed-lbl");if(el){el.textContent="Embed code copied!";setTimeout(function(){el.textContent="Get Embed Code";},2500);}});}