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

Adding a dedicated stylesheet to the page layout #85

Merged
merged 1 commit into from
Dec 22, 2023
Merged

Adding a dedicated stylesheet to the page layout #85

merged 1 commit into from
Dec 22, 2023

Conversation

samueleresca
Copy link
Member

Adding a dedicated stylesheet option to the page layout to support dedicated styling for pages.

@pjfanning
Copy link
Contributor

I don't quite get how this works. There is already material.custom.stylesheet. So far, the only examples I have seen of these props being set - sets them for the whole build. I'm not sure how they can be set on a per page basis.
What if page.properties has both stylesheet properties set - won't that lead to 2 <link rel="stylesheet" entries?

I still have a big preference for #84 and gutting this project. It is far too complicated to vote on pekko-sbt-paradox releases and then have to uptake the releases in so many places.

@samueleresca
Copy link
Member Author

samueleresca commented Dec 21, 2023

I don't quite get how this works. There is already material.custom.stylesheet. So far, the only examples I have seen of these props being set - sets them for the whole build. I'm not sure how they can be set on a per page basis. What if page.properties has both stylesheet properties set - won't that lead to 2 <link rel="stylesheet" entries?

I still have a big preference for #84 and gutting this project. It is far too complicated to vote on pekko-sbt-paradox releases and then have to uptake the releases in so many places.

These props can be set also at markdown level using the following approach:

---
material.custom.stylesheet: ../assets/stylesheet/style.css
---

## Apache Pekko

In case of the home we will have 2 <link rel="stylesheet" enties:

  1. One referring to the pekko-theme.css style (common to all docs pages)
  2. One referring to the home.css style (dedicated to the home)

That said, I agree that we need a more sustainable way of updating the static assets. I'm proceeding by commenting #84 with the next steps.

@pjfanning
Copy link
Contributor

Thanks, I wasn't aware that you can set properties that way (in the markdown file itself).

With that approach, do we need material.custom.page-stylesheet ? I'm still concerned that can end up with 2 <link rel="stylesheet" entries in the HTML.

@samueleresca
Copy link
Member Author

Thanks, I wasn't aware that you can set properties that way (in the markdown file itself).

With that approach, do we need material.custom.page-stylesheet ? I'm still concerned that can end up with 2 <link rel="stylesheet" entries in the HTML.

Yes, we gonna end up with +1 <link rel="stylesheet" in the HTML. At the moment, the page is rendered as:

...
<meta name="description" content="incubator-pekko-site">
<link rel="shortcut icon" href="assets/images/pekko_favicon.png">
<title>Apache Pekko</title>
<link rel="stylesheet" href="assets/stylesheets/application.451f80e5.css">
<link rel="stylesheet" href="assets/stylesheets/application-palette.22915126.css">
<link rel="stylesheet" href="lib/material__tabs/dist/mdc.tabs.min.css">
<link rel="stylesheet" href="lib/prettify/prettify.css">
<script src="assets/javascripts/modernizr.1aa3b519.js"></script>
<link rel="stylesheet" href="assets/fonts/font-awesome.css">
<link rel="stylesheet" href="assets/fonts/material-icons.css">
<link rel="stylesheet" href="assets/stylesheets/paradox-material-theme.css">
<link rel="stylesheet" href="assets/stylesheets/pekko-theme.css">
</head>
...

This change, in combination with a home.md specifying the following:

---
material.custom.page-stylesheet: ../assets/stylesheet/home.css
---

## Apache Pekko

The rendered result will be:

...
<meta name="description" content="incubator-pekko-site">
<link rel="shortcut icon" href="assets/images/pekko_favicon.png">
<title>Apache Pekko</title>
<link rel="stylesheet" href="assets/stylesheets/application.451f80e5.css">
<link rel="stylesheet" href="assets/stylesheets/application-palette.22915126.css">
<link rel="stylesheet" href="lib/material__tabs/dist/mdc.tabs.min.css">
<link rel="stylesheet" href="lib/prettify/prettify.css">
<script src="assets/javascripts/modernizr.1aa3b519.js"></script>
<link rel="stylesheet" href="assets/fonts/font-awesome.css">
<link rel="stylesheet" href="assets/fonts/material-icons.css">
<link rel="stylesheet" href="assets/stylesheets/paradox-material-theme.css">
<link rel="stylesheet" href="assets/stylesheets/pekko-theme.css">
<link rel="stylesheet" href="assets/stylesheet/home.css">
...

This would allow us to keep the pekko-theme.css as a common stylesheet for common elements such as footer,header, nav bar.
On top of that, we can optionally specify a <page_name>.css to be used for styles specific to a page i.e.: homepage

This approach might be benefcial because:

Copy link
Contributor

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation. Change makes sense.

@samueleresca samueleresca merged commit 1bc182b into apache:main Dec 22, 2023
1 check passed
@samueleresca samueleresca deleted the dedicated-page-stylesheet branch December 22, 2023 09:26
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