Readonly dashboard view

Hi all,
Been reading a few posts about various ways of disabling edit access in certain situations (mobile etc). Thought I'd share that approach I set up the other day.
Sorry if it's too basic for this channel :laughing:
I set dash:index to be my start page because it's mostly just links to journals, tasks etc, and I rarely want to edit it.

---
description: Read-only mirror dash:<page>
tags: meta
---

```space-lua
-- priority: 6
-- Mirrors page "dash:<X>" from real page "<X>" (read-only + footer link).
-- Do not create dash:<name>.md or it shadows this behavior.

virtualPage.define {
  pattern = "^dash:(.+)$",
  run = function(source)
    local ok, body = pcall(function()
      return space.readPage(source)
    end)
    if not ok then
      return "# Page not found\n\nCould not read **"
        .. source
        .. "** (`"
        .. source
        .. ".md`). It may be missing, offline, or not reachable yet.\n"
    end
    return body
      .. "\n\n---\n\nRead-only [[DashViewRouter|dashboard]] — edit source: [["
      .. source
      .. "]]\n"
  end,
}
5 Likes