Artalk Documentation

repository·master·Indexed 25 days ago

https://github.com/artalkjs/artalk

A self-hosted, feature-rich comment system consisting of a lightweight Vanilla JS client and a high-performance Golang-powered server. Documentation covers Docker deployment, client integration, and a comprehensive plugin ecosystem including the @artalk/plugin-kit for development, eslint-plugin-artalk for linting, and official plugins for authentication, KaTeX, and lightbox.

Tokens
48.6K
Snippets
148
Records
276
Agent score
81%

What's inside Artalk

  1. Overview of Artalk features

    master

    Artalk is a lightweight, feature-rich comment system. Key capabilities include:

    • Frontend: ~40KB Vanilla JS, sidebar management, social login, Markdown support, emoticons (OwO compatible), LaTeX support, night mode, and image lightbox.
    • Backend: High-performance Golang server, email/push notifications, captcha, comment moderation (spam/content detection), image uploading (custom/image bed support), and multi-site management.
    • Management: Admin dashboard, comment voting, sorting, pinning, search, and data migration/backup.
    • Extensibility: Plugin system and OpenAPI-formatted API documentation.
  2. Overview of Artalk Development Resources

    master

    Artalk provides several entry points for developers depending on whether you are integrating the comment system, building plugins, or working on the backend.

    • Frontend Integration: Guides for embedding Artalk in blogs or frameworks, using the Frontend API, listening to Frontend Events, and configuring the frontend.
    • Plugin Development: Documentation for building plugins and integrating them with Vite.
    • Backend Development: Access to HTTP API documentation, environment variable configuration, and backend configuration files.
    • Contribution: For setting up a local development environment to contribute to the core project, refer to the Developer Contribution Guide.
  3. Overview of Artalk commenting system

    master

    Artalk is a lightweight, feature-rich commenting system designed for easy deployment and integration into blogs, websites, or web applications.

    Architecture

    • Frontend: Built with TypeScript (Vanilla JS), it is lightweight (~40KB gzipped) and free of redundant dependencies.
    • Backend: Rewritten in Golang (Artalk v2), it is cross-platform, compact, and designed for rapid deployment.

    Key Capabilities

    Artalk provides a wide range of features including:

    • User Engagement: Markdown support, emoji packs (compatible with OwO), LaTeX formula parsing, and comment voting (upvote/downvote).
    • Management: A sidebar for quick management, multi-site isolation, admin dashboards, and comment moderation (spam interception and content detection).
    • User Experience: Auto-save to prevent data loss, auto-fill user info via browser caching, night mode, and image lightbox integration.
    • Notifications: Email notifications and various push methods.
    • Extensibility: Support for extension plugins and OpenAPI-formatted API documentation.
  4. Overview of Artalk

    master

    Artalk is an intuitive and feature-rich comment system designed for immediate integration into any blog, website, or web application. It consists of a lightweight Vanilla JS client (~40KB) and a high-performance Golang server.

    Key characteristics:

    • Client: Framework-agnostic, pure Vanilla JS.
    • Server: Efficient, lightweight, and cross-platform via Golang.
    • Deployment: Supports one-click deployment via Docker.
    • Privacy: Open-source and self-hostable, prioritizing user privacy.
  5. Understand the Artrans data format

    master

    Artalk uses a persistent data storage standard called Artrans (Artran + Artrans).

    • An Artran is a single comment data object.
    • Artrans is a JSON array containing multiple Artran objects.

    This format is used for all data migrations, backups, and imports within Artalk.

    {
      "id": "123",
      "rid": "233",
      "content": "Hello Artalk",
      "ua": "Artalk/6.6",
      "ip": "233.233.233.233",
      "created_at": "2021-10-28 20:50:15 +0800",
      "updated_at": "2021-10-28 20:50:15 +0800",
      "is_collapsed": "false",
      "is_pending": "false",
      "vote_up": "666",
      "vote_down": "0",
      "nick": "qwqcode",
      "email": "qwqcode@github.com",
      "link": "https://qwqaq.com",
      "password": "",
      "badge_name": "Administrator",
      "badge_color": "#FF716D",
      "page_key": "https://artalk.js.org/guide/transfer.html",
      "page_title": "Data Migration",
      "page_admin_only": "false",
      "site_name": "Artalk",
      "site_urls": "http://localhost:3000/demo/,https://artalk.js.org"
    }
  6. Supported Emoticon Formats

    master

    Artalk supports two primary formats for emoticon data files:

    1. OwO Format: An open-source format compatible with the OwO JS plugin. You can use existing OwO JSON resources directly by providing their URL.
    2. Artalk Standard Format: A native JSON/JS array format that allows you to define groups of emoticons. Each group must specify a name, a type ('emoticon' for text or 'image' for images), and an items array containing key and val pairs.
    [
      {
        name: 'Emoji',
        type: 'emoticon', // Text type
        items: [
          { key: 'Hi', val: '|´・ω・)ノ' },
          { key: 'Happy', val: 'ヾ(≧∇≦*)ゝ' },
        ],
      },
      {
        name: 'Funny',
        type: 'image', // Image type
        items: [
          {
            key: 'Original Funny',
            val: '<Image URL>',
          },
        ],
      },
    ]
  7. Bind Page Views and Comment Counts to HTML elements

    master

    You can display statistics anywhere on your page by using specific CSS selectors and the data-page-key attribute.

    • pvEl: The selector for the element that displays Page Views (Default: '.artalk-pv-count').
    • countEl: The selector for the element that displays Comment Counts (Default: '.artalk-comment-count').
    • statPageKeyAttr: The attribute name used to specify the page key (Default: 'data-page-key').

    Usage Example: To show the comment count for a specific page, use: <span class="artalk-comment-count" data-page-key="/t/1.html"></span>

  8. How Account Merging works

    master

    If a user logs in and Artalk detects multiple accounts with different usernames but the same email address, an Account Merging Tool will appear.

    Users can choose to keep one specific username. Once selected, all comments and data associated with that email address are merged into the retained account. The original duplicate accounts are deleted, and the username on all associated comments is updated to the retained username.

  9. How relative paths are resolved

    master

    When a relative path is provided in pageKey, Artalk resolves it by combining the site URL (configured in the Artalk Dashboard) with the relative path.

    For example, if the site URL is https://set-example-site-url.xxx and the pageKey is /relative-path/xx.html, the resolved URL will be https://set-example-site-url.xxx/relative-path/xx.html.

    These resolved URLs are used for:

    • Email notifications (links to reply to comments)
    • Sidebar (quick jumps to specific comments)
    • Dashboard (page management and opening pages)
    • Fetching page titles and other metadata