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(footer): add configurable copyright notice #112

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

welpo
Copy link
Owner

@welpo welpo commented Aug 18, 2023

TL;DR Add a dynamic and translatable copyright notice for the footer.

Description

This PR adds a feature that allows users to add a custom copyright notice in the footer of their site.

Key features:

  1. Dynamic year insertion:

    • Users can use the $CURRENT_YEAR placeholder to automatically have the current year inserted into the copyright notice, eliminating the need to manually update it each year.
  2. Markdown support:

    • Enhanced the notice with Markdown support, letting users easily add links, emphasize text, or make other necessary formatting changes.
  3. Multi-language support:

    • For sites in multiple languages, there's an option to set a translated version of the copyright.

Changes

  1. TOML configuration:

    • Added copyright and translate_copyright options.
    • Provided comments explaining the purpose and usage of each option.
  2. Tera template:

    • Updated the footer template to include the new copyright feature.
    • Ensured that the translated version is used based on site's language configuration and user preference.
  3. Footer CSS:

    • Centered the footer text and removed the margin between paragraphs.

Screenshots:

  • A simple notice:

    [extra]
    copyright = "© $CURRENT_YEAR welpo

    simple

  • A more complex notice, with Markdown:

    [extra]
    copyright = "© $CURRENT_YEAR Your Name • Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."

    complex

- The text `$CURRENT_YEAR` will be replaced by the current year.

- Can be translated.

- Markdown is rendered.
@welpo welpo added the enhancement New feature or request label Aug 18, 2023
@welpo welpo merged commit 5ae21b5 into main Aug 18, 2023
1 check passed
@welpo welpo deleted the feat/copyright-notice branch August 18, 2023 21:12
@Jieiku
Copy link
Contributor

Jieiku commented Aug 18, 2023

Such a clean implementation! You may have noticed I was dancing around the Year in abridge. This is a much better solution! Thank You!

@welpo
Copy link
Owner Author

welpo commented Aug 18, 2023

Hehe thanks I looked at Abridge and saw so many config variables… Decided to keep it as simple as possible! (If only I could also auto-detect the translated copyright without an extra variable…)

welpo added a commit that referenced this pull request Aug 18, 2023
@welpo
Copy link
Owner Author

welpo commented Aug 18, 2023

Just added the option to also replace $SEPARATOR to the config.extra.separator variable on f1edbba.

So this Copyright notice:

complex

Can now be set with:

[extra]
copyright = "© $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants