Skip to content

Layouts page rewrite#9335

Merged
sarah11918 merged 3 commits into
mainfrom
layouts-revamp
Sep 7, 2024
Merged

Layouts page rewrite#9335
sarah11918 merged 3 commits into
mainfrom
layouts-revamp

Conversation

@sarah11918
Copy link
Copy Markdown
Member

Description (required)

This lightly updates the /basics/layouts.mdx guide page to:

  • Prepare for a rewrite of the existing Markdown page that will hold more of the Markdown-specific content (e.g. the removed code example of exported properties) so that the Layout page is less cluttered and mostly focused on the pattern
  • Simplify by downplaying MDX and concentrating on Markdown (our built-in, first class citizen) (as the new Markdown page will, moving some content directly to the MDX page)

The only content temporarily lost in published docs as a result of this is the code example, but a version of that will exist in the new Markdown page, where it is more helpful and discoverable.

@netlify
Copy link
Copy Markdown

netlify Bot commented Sep 7, 2024

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 7280072
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/66dc66849f14b600085b77c9
😎 Deploy Preview https://deploy-preview-9335--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Sep 7, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en basics/layouts.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Comment thread src/content/docs/en/basics/layouts.mdx Outdated
</body>
</html>
```
<ReadMore>Learn more about Astro’s Markdown and MDX support in our [Markdown guide](/en/guides/markdown-content/).</ReadMore>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just noting that it's an intentional choice to leave "and MDX" in here because this section only is about MDX. And, the Markdown guide is a good place to read about general Markdown (in MDX) stuff.


<ReadMore>Learn more about [slots](/en/basics/astro-components/#slots).</ReadMore>

## Using TypeScript with layouts
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just noting that I moved this up for prominence, and to push the Markdown layout content (more niche/specific use case) lower on the page.

### Importing Layouts Manually (MDX)

You may need to pass information to your MDX layout that does not (or cannot) exist in your frontmatter. In this case, you can instead import and use a [`<Layout />` component](/en/basics/layouts/) and pass it props like any other component:
You can also use the special Markdown layout property in the frontmatter of MDX files to pass `frontmatter` and `headings` props directly to a specified layout component in the same way.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just noting that this is basically what you get when you use the layout property in MDX files, so rather than complicate the list above, I intentionally made the entire thing above about Markdown, in favour of a streamlined sentence here.

Copy link
Copy Markdown
Member

@at-the-vr at-the-vr left a comment

Choose a reason for hiding this comment

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

Sending in couple of title suggestions 😄

Comment thread src/content/docs/en/basics/layouts.mdx Outdated
Comment thread src/content/docs/en/basics/layouts.mdx Outdated
Copy link
Copy Markdown
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

I have nothing to say with your changes (except a typo in a code block). Looks good to me!

Some additional feedback about the page structure:

  • Moving the Typescript section outside of the Markdown layouts seems more consistent to me (this has nothing to do with Markdown). So I approve!
  • I wonder if "Nesting Layouts" should not be between "Using TypeScript with layouts" and "Markdown Layout". Like you said, Markdown Layout are "more niche/specific use case" so I think this section should be the last... Especially if we want to encourage people to use content collections when possible... That said, my opinion may be biased. 😅

I also added other suggestions on portions you did not modify. This is mostly nitpicking!

Comment thread src/content/docs/en/basics/layouts.mdx Outdated
Comment thread src/content/docs/en/basics/layouts.mdx Outdated
Comment thread src/content/docs/en/basics/layouts.mdx
Comment thread src/content/docs/en/basics/layouts.mdx Outdated
Comment thread src/content/docs/en/basics/layouts.mdx Outdated
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
Co-authored-by: Atharva <atharvapise19@gmail.com>
@sarah11918
Copy link
Copy Markdown
Member Author

sarah11918 commented Sep 7, 2024

I wonder if "Nesting Layouts" should not be between "Using TypeScript with layouts" and "Markdown Layout".

I did think about this, and debate it. BUT, I ended up thinking that it was more useful after showing Markdown layouts, because that's actually the exact pattern we were intending to show: having a Markdown layout wrapped in your regular BaseLayout. So, I think the stronger argument is to show it after we've shown BlogPostLayout(Layout) so that the use case for it has already been made.

And, you should see the changes coming to the Markdown page... it's really going to be encouraging collections! 😄

@sarah11918
Copy link
Copy Markdown
Member Author

Thank you both for your reviews @ArmandPhilippot and @at-the-vr ! I really appreciate getting feedback on a quiet Saturday so I can keep on trucking.... 🚚

Copy link
Copy Markdown
Member Author

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Why did I make a review instead of comment? Have to finish this off.

Comment thread src/content/docs/en/basics/layouts.mdx Outdated
@sarah11918 sarah11918 merged commit 1096370 into main Sep 7, 2024
@sarah11918 sarah11918 deleted the layouts-revamp branch September 7, 2024 14:50
@ArmandPhilippot
Copy link
Copy Markdown
Member

ArmandPhilippot commented Sep 7, 2024

that's actually the exact pattern we were intending to show: having a Markdown layout wrapped in your regular BaseLayout.

Oh yes, I hadn't paid attention to the example in "Nesting Layouts"... the order is therefore consistent.

thomasbnt added a commit to thomasbnt/docs that referenced this pull request Sep 9, 2024
Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com>
yanthomasdev added a commit that referenced this pull request Sep 11, 2024
* i18n(fr): Update `basics/layouts` from #9335

Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com>

* i18n(fr): Update `basics/layouts` from #9344

Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com>

* Update src/content/docs/fr/basics/layouts.mdx

Co-authored-by: Armand Philippot <git@armand.philippot.eu>

* Update src/content/docs/fr/basics/layouts.mdx

Co-authored-by: Armand Philippot <git@armand.philippot.eu>

* Nesting Layouts part

Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com>

* Update src/content/docs/fr/basics/layouts.mdx

Co-authored-by: Armand Philippot <git@armand.philippot.eu>

---------

Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com>
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
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.

4 participants