## Implementation Plan: Shareable Comment Permalinks ### Overview Add a `data-share` button to comment action bars, enabling clipboard-copy of `{parent_url}#comment-{uid}`. No backend, JS, CSS, test, or configuration changes required. Three files, ~8 lines total. --- ### Changes #### 1. `devplacepy/templating.py` Add import and register `resolve_object_url` as a Jinja global. - At the top of the file, add: `from devplacepy.database.content import resolve_object_url` - In the globals registration block (around line 215), add: `templates.env.globals["resolve_object_url"] = resolve_object_url` #### 2. `devplacepy/templates/_comment_section.html` Compute the parent URL from the available `target_type`/`target_uid` variables and pass it to the `render_comment` macro. - After the `{% set target_uid,... %}` block (which comes from the includer), insert: `{% set parent_url = resolve_object_url(target_type, target_uid) %}` - Change the render call at line 7: `{{ render_comment(item, 0, parent_url) }}` #### 3. `devplacepy/templates/_comment.html` Thread the `parent_url` parameter through the macro chain and add the share button. - `render_comment(item, depth=0, parent_url=None)` – add `parent_url=None` - `comment_cell(item, depth, parent_author=None, parent_url=None)` – add `parent_url=None` - `render_comment_flat(item, depth, parent_author, parent_url=None)` – add `parent_url=None` - In `comment_cell`, inside the `{% call render_comment_cell(item, ...) %}` block, pass `parent_url` through: `{{ comment_cell(item, visual_depth, parent_url=parent_url) }}` (check actual call chain: `render_comment` calls `comment_cell` with two args; add `parent_url=parent_url`) - In `render_comment_flat`, pass `parent_url` to `comment_cell` accordingly. - Inside the `.comment-actions` div (after the Reply button, before the Edit button), add: ```html ``` --- ### Definition of Done - [ ] The three files are modified exactly as specified above. - [ ] Project lint passes: `pip install -q ruff && ruff check .` (exit 0). - [ ] Project unit tests pass: `pip install -e '.[dev]' -q && make test-unit` (exit 0). - [ ] Share button appears on every comment visible in the UI (post, news, gist, project detail pages). - [ ] Clicking the share button copies `{page_url}#comment-{uid}` to clipboard and shows a "Copied!" toast. - [ ] Navigating directly to `.../post/example#comment-abc` scrolls to the comment and applies the `.comment-highlight` fade animation.