Skip to content

Display total channel views and channel creation date on the public channel page #7648

@lipfelipef

Description

@lipfelipef

Describe the problem to be solved

PeerTube version: confirmed on v8.2.0.

The public channel page currently shows the subscriber count and the number of videos (e.g. "23 subscribers · 61 videos"), but it doesn't surface two pieces of information that viewers commonly look for: the channel's total view count (summed across all its videos) and the channel's creation date. Nothing is broken here — both work fine elsewhere — so this is really an enhancement to make existing data visible where viewers would expect it. These values serve as social proof for creators and as a quick credibility signal for viewers ("how long has this channel existed, and how much has it been watched overall").

The key point is that both values already exist in PeerTube's backend on v8.2.0, which is why this feels like a low-cost addition rather than new functionality:

  • Channel creation date: the createdAt field is already returned by the public single-channel endpoint (GET /api/v1/video-channels/{handle}) and is already parsed by the client Actor model. The public channel page component already has videoChannel.createdAt available in memory — it is simply not rendered in the template.

  • Total channel views: the aggregate is already computed in the backend as SUM("video".views) over the channel's videos (added by Added "total views" in the my channels list #5007, "total views in the my-channels list"), is already a field on the client VideoChannel model, and is already served publicly via GET /api/v1/accounts/{handle}/video-channels?withStats=true (verified on my instance: totalViews: 424, videosCount: 61, no authentication required). It is already displayed today in the authenticated "My channels" list to the channel owner — just not on the public channel page that any visitor sees.

So both data points are already produced by PeerTube; they are simply not displayed on the public channel page.

Describe the solution you would like

On the public channel page, display the channel's total view count and creation date alongside the existing stats (subscribers and video count). The channel page doesn't use a tabbed layout, so rather than adding a separate tab or page, the most natural place is the existing stats area — e.g. extending "23 subscribers · 61 videos" to also include total views, and showing the creation date (e.g. "On PeerTube since May 2021") near the channel name or description.

A couple of implementation notes from inspecting v8.2.0, in case they help scope it:

  • Creation date: this one is trivial. createdAt is already in the public channel JSON and already parsed on the client (Actor.createdAt), so the value is already present in the channel page component. It's a template-only change in +video-channels/video-channels.component.html — no backend change, no model change, no new query.

  • Total views: slightly more wiring, but no new computation. totalViews is already a VideoChannel model field and already computed by the existing SQL (Added "total views" in the my channels list #5007). The only gap is that the single-channel endpoint used by the channel page currently ignores withStats (verified: GET /video-channels/{handle}?withStats=true still returns no totalViews/videosCount/viewsPerDay). So this needs either (a) the single-channel endpoint/service to accept withStats, or (b) the channel page to read the aggregate from the existing accounts/{handle}/video-channels?withStats=true response. Either way, the aggregation SQL already exists and already runs in production.

Both values could optionally be made configurable by the admin, in case there's concern about smaller channels exposing low totals — but the data itself is low-cost and low-risk to surface, since PeerTube already produces it and (for views) already serves it publicly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions