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: allow per-page description customization #310

Merged
merged 6 commits into from
Jul 3, 2024
Merged

Conversation

meysam81
Copy link
Contributor

@meysam81 meysam81 commented Jun 25, 2024

Hello @Guts

Thanks for the awesome project.

I use this plugin heavily in my SRE blog.

I figured it would be nice to allow per page customization of the description field, cause at the moment, there's not a lot one can do when the description before <!-- more --> is short and extra detail is desired.

With this change, you can have separate contents for RSS description and your typical content.

An example taken from the Material for Mkdocs Social Cards:

---
date: 2024-06-24
description: >-
  This is the SEO description.
social:
  cards_layout_options:
    description: >-
      This is the social cards description.
rss:
  feed_description: >-
    And I want to have customized RSS description.
---

This idea, I reckon, can easily be extended for other similar use-cases:

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jun 25, 2024
@Guts
Copy link
Owner

Guts commented Jun 27, 2024

Hi @meysam81 ,

Thanks for your PR. I'm still thinking if it's worth it because it adds a certain complexity from an operational point of view, with nesting levels that are difficult to track and debug.

Remarks:

  • can you explain why the description is not enough for your need?
  • since it adds something a bit hard to understand and kind of complexity, can you write a documentation more extensive? Maybe a subsection How to customize feed 's item description per page with a different
  • can you comply with contributing guidelines and add tests cases please? It does really matter for the project maintainability.

@meysam81
Copy link
Contributor Author

meysam81 commented Jun 27, 2024

can you explain why the description is not enough for your need?

description is used for SEO description and in order to optimize it, you'd normally keep it short in around 140-156 characters.
RSS description, however, can go a little wild in the length and doesn't have to comply with anything, especially knowing that it will provide more context to the RSS clients before clicking on Continue reading....

I will add the docs and the tests later this week.

Thanks for the feedback.

@github-actions github-actions bot added the quality Tests, project resiliency, etc. label Jul 1, 2024
@meysam81
Copy link
Contributor Author

meysam81 commented Jul 3, 2024

@Guts

Please have another look and let me know if there's any other change required.

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.70%. Comparing base (c62cb56) to head (6506bae).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
+ Coverage   80.64%   80.70%   +0.05%     
==========================================
  Files          10       10              
  Lines         651      653       +2     
  Branches      133      134       +1     
==========================================
+ Hits          525      527       +2     
  Misses         86       86              
  Partials       40       40              
Flag Coverage Δ
unittests 80.55% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
mkdocs_rss_plugin/util.py 73.52% <100.00%> (+0.19%) ⬆️

Copy link
Owner

@Guts Guts left a comment

Choose a reason for hiding this comment

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

LGTM 🚀!

Thanks a lot for your contribution!

@Guts Guts merged commit 64966c7 into Guts:main Jul 3, 2024
8 checks passed
@Guts Guts added the enhancement New feature or request label Jul 3, 2024
@Guts
Copy link
Owner

Guts commented Jul 3, 2024

Released as part of https://github.com/Guts/mkdocs-rss-plugin/releases/tag/1.15.0

Comment on lines +192 to +195
social:
cards_layout_options:
description: >-
This is the social cards description.
Copy link
Contributor

Choose a reason for hiding this comment

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

Late to the party, but I feel like the social options here aren't really necessary for an RSS example...

Copy link
Owner

Choose a reason for hiding this comment

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

Fair enough. Feel free to make a quick PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request quality Tests, project resiliency, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants