Skip to content

feat(core-cms): redirect blog posts without new plugin#128

Merged
jarosenb merged 24 commits intomainfrom
task/redirect-blog-articles-without-plugin
Feb 7, 2023
Merged

feat(core-cms): redirect blog posts without new plugin#128
jarosenb merged 24 commits intomainfrom
task/redirect-blog-articles-without-plugin

Conversation

@wesleyboar
Copy link
Copy Markdown
Member

@wesleyboar wesleyboar commented Feb 6, 2023

Overview

Redirect certain blog posts without using a plugin.

Changes since 2023-06-02 Feedback
  • Redirection on News Articles does not require manual URL.
  • Core CMS provides static tag classes on markup.
  • TUP CMS JavaScript relies on static tag classes.
  • TUP CMS re-uses code to find external article URL.
  • Knowledge that Google could send user to article URL.

Related

Changes

  • change core-cms image tag
  • add cms setting to identify redirect articles
  • add redirect snippet template
  • add blog list external url snippet

Testing

Remote

Open External Article in New Tab

Add Redirect Feature to News

  1. On news listing, in "Footer-Content", create a new snippet.
  2. Set "HTML:" to external.
  3. Set "TEMPLATE:" to snippets/news/open-external-post.html
  4. Save snippet.

Redirect Article in List to New Tab

  1. Create article that has:
    1. external link in its abstract
      To make the link invisible, you may add hidden attribute on the link.
    2. tag external (add within "Info" section)
  2. In news listing, in edit mode, verify article heading text link opens external URL in new tab.
  3. In news listing, in view mode, verify article box (whole thing is a link) opens external URL in new tab.
  4. In news listing mode, verify article that is not tagged external, opens article.

Verify New Core-CMS Features

  1. feat(settings): TACC_BLOG_SHOW_ABSTRACT_TAG Core-CMS#592
    Verify the article page, for the external-tagged article, show its abstract beneath the header and visual.
  2. feat(djangocms_blog): article 'has-blog-tag-...' class names Core-CMS#593/feat(djangocms_blog): drop scripts in favor of template overwrites Core-CMS#596
    Verify the external-tagged article, in the news listing, has the class has-blog-tag-external.

Redirect an Article Page to New Tab

Why
In case user reaches article page (via Google or "Open External Article in New Tab" fails).

  1. On article page, in "Post-Content", create a new snippet.
  2. Set "HTML:" to https://www.designsafe-ci.org/community/news/2022/december/towers-storm/. 1
    Leave "HTML:" blank 1
  3. Set "TEMPLATE:" to snippets/redirect.html
  4. Save snippet.
  5. Reload article page.
  6. Verify page redirects to https://www.designsafe-ci.org/community/news/2022/december/towers-storm/ in same window.
  7. Open local article page with ?edit at the end of the URL (e.g. https://dev.tup[…]towers-storm?edit.
  8. Verify page does not redirect.

UI

Notice
Screenshots may show me locally having used redirect tag instead of external tag.

Open External Article in New Tab

heading URL abstract URL footer URL category url
heading link link in abstract footer link (stretched over article) category url
target="_blank" regular post
links target _blank REGULAR ARTICLE - heading link
has redirect tag, has link change no redirect tag, no link change
has redirect tag, has link change no redirect tag, no link change

New Core-CMS Features

TACC/Core-CMS#592 TACC/Core-CMS#593/TACC/Core-CMS#596
abstract shows on redirect-tagged post post has has-blog-tag-___ class

Redirect Snippet

create snippet1 add snippet edit post (no redirect)
redirect snippet content redirect snippet added edit post
redirect.snippet.active.mov

Footnotes

  1. The "HTML:" URL is not required since 14298c9, which tells redirect JavaScript how to auto-find an article's external URL. But, it will still work, and take precedence. 2 3

@wesleyboar wesleyboar changed the title feat(core-cms): TACC_BLOG_SHOW_ABSTRACT_TAG feat(core-cms): redirect blog posts without new plugin Feb 6, 2023
@wesleyboar wesleyboar marked this pull request as ready for review February 6, 2023 22:03
Copy link
Copy Markdown
Collaborator

@jarosenb jarosenb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works in dev.

@jarosenb jarosenb merged commit 1b11d5e into main Feb 7, 2023
@jarosenb jarosenb deleted the task/redirect-blog-articles-without-plugin branch February 7, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants