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

🐛 fix(comments): fix malformed URLs in Isso mails #211

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

welpo
Copy link
Owner

@welpo welpo commented Oct 25, 2023

Description

This PR aims to address the issue of malformed URLs in the email notifications generated by Isso, as detailed in #210.

Changes

  • Modified the Tera template to change how data-isso-id and data-title are set.

Implementation details

The previous setup used the page's slug to populate data-isso-id and data-title. This resulted in URLs lacking a separating slash between the domain and the identifier/post in the email notifications.

The new setup uses default_lang_url in Tera templates to populate these attributes:

{%- set default_lang_url = current_path | replace(from='/' ~ lang ~ '/', to = '/') -%}
    data-isso-id="{{ default_lang_url }}"
    data-title="{{ default_lang_url }}"
{% endif %}

Limitations

While this solution is effective for most use-cases, it's not perfect. Specifically, if a post does not exist in a non-default language, the URL in the email notification will still return 404. However, as far as I know, this is the only way to merge comments in multilingual sites effectively.

Testing

  1. Enable Isso comments on the site.
  2. Enable email notifications in the Isso setup.
  3. Configure page_id_is_slug = true in [extra.isso].
  4. Submit a comment.
  5. Verify that the received email notification contains the correct and functional link to the comment.

@welpo welpo added the bug Something isn't working label Oct 25, 2023
@welpo welpo merged commit be218c0 into main Oct 25, 2023
1 check passed
@welpo welpo deleted the fix/malfored-isso-urls branch October 25, 2023 15:47
Smtbook pushed a commit to Smtbook/zola-theme-tabi that referenced this pull request Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant