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

RFC: SectionPage with ContentType and ContentSubType #456

Open
bobaaaaa opened this issue Nov 21, 2022 · 2 comments
Open

RFC: SectionPage with ContentType and ContentSubType #456

bobaaaaa opened this issue Nov 21, 2022 · 2 comments
Assignees
Labels
🎁 API API/Model changes 📔 RFC Request for comments

Comments

@bobaaaaa
Copy link
Contributor

bobaaaaa commented Nov 21, 2022

What

Currently, we only have:

ArticlePage.Article.type
ArticlePage.Article.sub_type

I would like to introduce the following addition (naming tbd):

SectionPage.Section.type = 'section'
SectionPage.Section.sub_type = 'news' | 'frontpage' | 'advertorial' | 'themepage'

In paper is already a type section. This makes it much easier for us to calculate standard info/properties/values in some places. We have an interface Page shared between Article- and Section-Pages.

More Examples

  • /test-homepage/ could also have the sub_type frontpage.
  • /themen/* with sub_type themen for easier cache header
  • /authors/ with sub_type author for custom commercial settings
@bobaaaaa bobaaaaa added 📔 RFC Request for comments 🎁 API API/Model changes labels Nov 21, 2022
@bobaaaaa bobaaaaa changed the title RFC: SectionPage mit ContentType und ContentSubType RFC: SectionPage with ContentType and ContentSubType Nov 21, 2022
@thisismana
Copy link
Member

thisismana commented Dec 8, 2022

I approve this motion!

edit: @bobaaaaa
if there is only one main type section, why do we need subtypes in the first place? maybe promote all suggested subtypes to main types instead?

@bobaaaaa
Copy link
Contributor Author

That could theoretically also work. The thing is, in paper we have a union (base) type for all pages (section & all articles). That means the typescript compiler would see something like this:

// with type "section" + subtypes
function foo(page: Page) {
  // page.type === 'article' | 'video' | 'gallery' | 'embed' | 'external' | 'author' | 'section'
  if (page.type === 'section') {
    // do something on all sections
  }
}

// with type "frontpage", "advertorial" + no subtypes
function foo(page: Page) {
  // page.type === 'article' | 'video' | 'gallery' | 'embed' | 'external' | 'author' | 'frontpage' | 'advertorial'
  if (page.type === 'frontpage' || page.type === 'advertorial') {
    // do something on all sections
  }
}

That is sometimes also hard for the article pages. There is no "base" identifier for content/detail pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎁 API API/Model changes 📔 RFC Request for comments
Projects
None yet
Development

No branches or pull requests

2 participants