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

Migrate robolectric.org to use MkDocs #212

Merged
merged 8 commits into from Apr 29, 2024

Conversation

MGaetan89
Copy link
Contributor

@MGaetan89 MGaetan89 commented Apr 24, 2024

Description

The goal of this PR is to migrate robolectric.org from the current HTML5 Up template to MkDocs.
This allows us to not have to maintain HTML pages and related assets (CSS/JS), by delegating that to MkDocs, unless some specific customisation in the layout is necessary.
Unless I've missed something, the link to each page remains the same as with the current website. So there shouldn't be any broken link from external tools.

You can see what the new website looks like here.

New website features

  • New Material design layout and navigation.
  • Support for light and dark modes, following the system setting by default.
  • Search bar, to quickly navigate to a specific section of the website.
  • "Back to top" button, to easily navigate back to the top of the page.

Maintainer changes

Changes made

  • Updated the Workflow to deploy the website.
  • Updated Dependabot configuration to support pip update.
  • Remove the _includes, _layouts, _sass, assets and images folders, as their contents are now managed by MkDocs.
  • Move the blog posts to the docs/blog/posts folder.

Maintaining the new website

Configuration

The configuration of the new website is in the mkdocs.yml file. This file is similar to the previous _config.yml file for Jekyll.
From there, you can customise the website metadata, theme, plugins, navigation, ...
You can find all the available options in the documentation.

Adding pages

To add a new page, create a new Markdown file in the docs folder. By default, it will not show up anywhere in the navigation, but you will be able to add links to it as follow [my link](my_new_page.md).
To add it to the navigation, edit the nav section in the mkdocs.yml file.

You can use the front-matter bloc at the beginning of your Markdown file to customise the layout of the page. For example:

---
hide:
- navigation # Hide the left navigation
- toc # Hide the table of content on the right
---

Adding a blog post

To add a new post, create a new Markdown file in the docs/blog/posts folder. On the list of posts, only the title and first paragraph will be displayed.

Here a sample post that you can reuse:

---
date: 2024-04-24
authors:
  - MGaetan89 # Must match a key in `docs/blog/.authors.yml`
hide: # This is the same as for regular pages
  - toc
---

# My post title

Post content.

Things to look out for

  • The blog posts are no longer available on the main page. This is being worked on in Blog: embed blog posts in other pages squidfunk/mkdocs-material#5074
  • I've used #7FC06B for the brand colour on the website (extracted from the logo). Let me know if it should be something else.
  • All the blog authors are listed in docs/blog/.authors.yml. Please make sure that the information I've put there are correct.
  • For the logo in the top bar, I've updated the existed logo to make it white. But the result is not perfect, as you can see in docs/images/robolectric-stacked.png. Maybe someone else should have a go at it?

Helpful links

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is exactly the same as in MkDocs Material, except for the following section:

<!-- START Robolectric modification -->
<!-- Share post -->
<ul class="md-post__meta md-nav__list">
<li class="md-nav__item md-nav__item--section">
<div class="md-post__title">
<span class="md-ellipsis">
Share
</span>
</div>
<nav class="md-nav">
<ul class="md-nav__list md-typeset">
<li class="md-nav__item">
<div class="md-nav__link">
{% include ".icons/fontawesome/brands/x-twitter.svg" %}
<span class="md-ellipsis">
<a href="https://x.com/intent/tweet?text={{ page.title }}&url={{ config.site_url }}{{ page.url }}&via=robolectric" rel="nofollow" target="_blank" title="Share on X">Share on X</a>
</span>
</div>
</li>
<li class="md-nav__item">
<div class="md-nav__link">
{% include ".icons/fontawesome/brands/facebook.svg" %}
<span class="md-ellipsis">
<a href="https://facebook.com/sharer.php?u={{ config.site_url }}{{ page.url }}" rel="nofollow" target="_blank" title="Share on Facebook">Share on Facebook</a>
</span>
</div>
</li>
</ul>
</nav>
</li>
</ul>
<!-- END Robolectric modification -->

@utzcoz
Copy link
Member

utzcoz commented Apr 24, 2024

@MGaetan89 Thanks. It looks aswsooooooome. @hoisie Please take a look at current status from above link. I like this one very much.

@utzcoz utzcoz changed the base branch from master to dev-new-site April 24, 2024 14:02
@utzcoz
Copy link
Member

utzcoz commented Apr 24, 2024

@MGaetan89 I changed the base branch for you. And I will merge it to dev branch after a detail reviewing.

MGaetan89 added a commit to MGaetan89/robolectric.github.io that referenced this pull request Apr 26, 2024
As requested in robolectric#212 (comment), I've extracted the changes that turn the links to the Javadoc into relative links in a dedicated PR.
utzcoz pushed a commit that referenced this pull request Apr 26, 2024
As requested in #212 (comment), I've extracted the changes that turn the links to the Javadoc into relative links in a dedicated PR.
@utzcoz
Copy link
Member

utzcoz commented Apr 29, 2024

@MGaetan89 Maybe we can merge it to dev branch now?

@utzcoz
Copy link
Member

utzcoz commented Apr 29, 2024

I want to use squash to merge this PR.

@MGaetan89
Copy link
Contributor Author

@MGaetan89 Maybe we can merge it to dev branch now?

Sure, you can go ahead and merge it 👍🏻

@utzcoz utzcoz merged commit 4fec7e9 into robolectric:dev-new-site Apr 29, 2024
@utzcoz
Copy link
Member

utzcoz commented Apr 29, 2024

@MGaetan89 Please continue it with javadoc directory movement.

@MGaetan89 MGaetan89 deleted the new_website branch April 29, 2024 12:07
utzcoz pushed a commit that referenced this pull request May 4, 2024
* Update Robolectric website

* Update MkDocs and MkDocs Material

* Fix javadoc URLs

* Continue deploying from the `new_website` branch until ready to merge

* Fix anchor in `device-configuration.md`

* Disable the footer feature

* Automatically create excerpt for blog posts

* Update mkdocs-material
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.

None yet

2 participants