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

Feat: Add a blog configuration with yaml #17214

Merged
merged 3 commits into from
May 11, 2023
Merged

Conversation

Dedelweiss
Copy link
Contributor

@Dedelweiss Dedelweiss commented Apr 6, 2023

  • Add input config, who allow to define the path import
  • Add output config, who allow to define the path destination
  • Add hidden, who allow to not generate the blog

Should I add warnings? For example when the path is not found. If so, how do I test? Because the path is searched for _blog but it is not found so the assert that asks for no warnings does not work as in this one.

Here is my proposal to add a blog configuration using a .yaml in the same place as the sidebar.yaml. This feature request is a bit old but I thought it would be interesting to create it to give a bit more flexibility to Scaladoc users.
This first PR allows me to validate with you if this feature is good to implement and also to have some feedbacks I answer well to what is asked and that my code is relevant. So if it is the case, I will do the tests and the associated documentation.

TO-DO list:

  • First version of the code
  • Add documentation

Will be implemented in docs.scala-lang, PR #2796:


Blog Configuration Documentation

Blog configuration is an important aspect of any blog platform. In order to customize the configuration of a blog, it is often necessary to modify the default settings. In this document, we will explain how to change the default config of a blog documentation with a file blog.yaml.

In order to modify the default settings of the blog documentation, users need to create a file named "blog.yaml" in the root directory of the blog. The file should contain the parameters that the user wants to change. For example, if a user wants to change the input directory to "my_posts", the output directory to "my_docs", and temporarily hide the blog, they can create a file with the following content:

blog.yaml:

input: my_posts
output: my_docs
hidden: true

Parameters:

The blog.yaml file is a configuration file that allows users to modify the default settings of their blog documentation. The following parameters can be configured in the blog.yaml file:

input: This parameter specifies the directory where the markdown pages and other files will be taken for the blogs page. By default, this is set to the "_posts" folder in the "docs" directory of the blog. However, users can change this to any other directory in "docs".

output: This parameter specifies the folder where the HTML pages will be generated. By default, this is set to the "blog" folder in the "target/docs" directory. However, users can change this to any other directory on "target/docs".

hidden: This parameter allows users to hide or unhide the blog temporarily. By default, this is set to "false", which means that the blog is visible to all users. However, if a user wants to temporarily hide the blog, they can set this parameter to "true". This can be useful if the user wants to make some changes to the blog and doesn't want anyone to see the changes until they are ready.

Once the file is created, the user needs to save it in the root directory of the blog. The next time the blog is built, the new settings will be applied.


  • Add tests

Example (Success)

Code & Input

Screenshot 2023-04-06 at 14 41 47

Screenshot 2023-04-06 at 14 41 58

Result

Screenshot 2023-04-06 at 14 42 09

First example (Hidden)

Code

Screenshot 2023-04-06 at 14 46 27

Result

Screenshot 2023-04-06 at 14 42 36

Screenshot 2023-04-06 at 14 42 47

Example (Error)

Screenshot 2023-04-06 at 14 43 03

Screenshot 2023-04-06 at 14 43 14

Fixes: #14487

- Add input config, who allow to define the path import
- Add output config, who allow to define the path destination
- Add hidden, who allow to not generate the blog
@Dedelweiss Dedelweiss force-pushed the blog_yml branch 3 times, most recently from 947963b to cef79e9 Compare May 3, 2023 15:29
Copy link
Contributor

@Florian3k Florian3k left a comment

Choose a reason for hiding this comment

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

LGTM, I left one small suggestion.

@Dedelweiss
Copy link
Contributor Author

Corrected, thank you for the feedback @Florian3k. I proposed a documentation related to this on docs.scala-lang: scala/docs.scala-lang#2796

@Florian3k Florian3k merged commit e8c6ebe into scala:main May 11, 2023
@Kordyjan Kordyjan added this to the 3.3.1 milestone Aug 2, 2023
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.

Add support for blog customization through YAML config
4 participants