Skip to content

Website (sitemap) ​

web_crawler syncs the public pages of one or more websites into the knowledge base from their sitemap, with scheduling, incremental runs, resume and deletion reconciliation. General flow: Data source import.

No account or key is needed: only public pages are read.

Setup in the knowledge base ​

  1. Knowledge base settings → Data sources → New, "Website (sitemap)".
  2. Website addresses, one per line:
    • the home page (https://www.example.com): the sitemap is found through robots.txt, then /sitemap.xml or /sitemap_index.xml;
    • a section (https://www.example.com/docs/): only pages under that path are kept;
    • the sitemap itself (https://www.example.com/sitemap-docs.xml).
  3. Optionally: paths to include (/docs, /blog), paths to exclude (/cart, /account), maximum pages per site (1000 by default, up to 10,000). Exclusion wins over inclusion.
  4. Test the connection: the test reads robots.txt and the first sitemap of each site.
  5. Check the sites to sync, pick the mode, schedule and deletion sync, save, then run a manual sync.

What a sync does ​

  • Sitemap indexes (up to 3 levels), gzip sitemaps (.xml.gz) and text sitemaps (one URL per line) are read.
  • Only pages on the same host as the configured address are read; a page redirecting to another site shows as an error in the sync history (moving between example.com and www.example.com is accepted).
  • robots.txt is honoured (the GsKnora group if there is one, * otherwise), as is Crawl-delay up to 10 s. Otherwise requests are spaced 300 ms apart.
  • HTML pages are reduced to their main content (menus and footers removed) and stored as Markdown, starting with the page title and address. PDF, Word, Excel, PowerPoint, text and CSV files listed in the sitemap are imported as is. Images, videos and archives are skipped.
  • A page whose lastmod did not change is not downloaded again. A page without lastmod is read again but re-imported only if its text changed.
  • A page removed from the sitemap, or answering 404 or 410, is removed from the knowledge base when deletion sync is on.
  • If robots.txt or the main sitemap is unreachable, the sync stops without deleting anything. If a nested sitemap is unreadable or the page limit is reached, the pages read are updated but nothing is deleted.
  • Files are stored as <host>/<path> (www.example.com/docs/install.md).

Network and security ​

Every request goes through the SSRF-safe client: an address or redirect to the internal network is refused. No authentication header is sent. The user agent is GsKnora-WebCrawler/1.0.

Implementation reference ​

Package internal/datasource/connector/webcrawler: sitemap.go (discovery, indexes, gzip, scope), robots.go (RFC 9309 rules, * and $ patterns), client.go (retries on 429/5xx and Retry-After up to 30 s), page.go (HTML to Markdown, file names, fingerprints), sync.go (walk, deletion reconciliation), cursor.go (fingerprint per URL). Resource IDs: site addresses.

GSMS Qualiopi · GsKnora engine, based on WeKnora v0.9.0 (MIT License)