Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tup 706 conditionally serve raw markup #872

Open
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Sep 13, 2024

Overview

Goal: Render TACC News outside of TACC (when we should not just link the user).

Feature: Allow client to load raw page content markup (no header, no footer).

Use Case? Load news pages of one website (e.g. TACC) on other websites (e.g. LCCF, WeTeach CS). By having raw markup available at a URL, another website can load and inject that markup on its own page, thus borrowing news articles and lists rather than duplicating them.

Proof of Concept? In #868, I create and run an app that injects remote content. (I am still thinking how/when best to run the app.)

Bonus: Allow dev to render a page with any Core template (or one of their own).

Use Case? Test new templates for future custom CMS features without editing Core.

How to Use One of Their Own? Add (or override) a template into taccsite_cms/templates via Dockerfile, as is done in some Core-CMS-Custom projects (apcd_cms, ecep_cms) and TUP (tup-cms).

Related

Changes

  • added middleware to change template at runtime before render

Testing

  1. In custom_app_settings.py, add new middleware to CUSTOM_MIDDLEWARE e.g.

    CUSTOM_MIDDLEWARE = ['taccsite_cms.middleware.cms_template.CMSTemplateMiddleware']
  2. Load pages with recognized query parameters.

    ?raw template=raw.html
    good - raw good - template raw html
  3. Verify page loads with raw.html template.

  4. Load pages with ineffectual query parameters.

    (no query) ?rawng template=raw template=raw
    noop noop - rawng noop - template noop - template raw
  5. Verify page loads with template that the page would normally use.

wesleyboar and others added 30 commits July 19, 2024 15:54
NOT WORKING! Fails with:

> NoReverseMatch at /feed/
> '' is not a registered namespace
Fails, because it renders nothing.
Load `/blog/remote`.

BREAKING CHANGE: Changed `/blog` to `/blog/local`
⚠️ Does NOT render feed items.
This reverts commit 6bece39.

This did not fix anything. `SESSION_COOKIE_SECURE=False` is still required locally.
- ✓ fix links to articles
- ✓ fix pagination links
@wesleyboar wesleyboar mentioned this pull request Sep 13, 2024
11 tasks
@wesleyboar wesleyboar added feature A new feature or replacement of present feature effort XS Extra small effort task (~¼ a week) — does not include review time labels Sep 13, 2024
@wesleyboar wesleyboar marked this pull request as ready for review September 13, 2024 21:22
@wesleyboar wesleyboar changed the title feat: tup 706 serve raw content conditionally feat: tup 706 conditionally serve raw markup Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort XS Extra small effort task (~¼ a week) — does not include review time feature A new feature or replacement of present feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant