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 json issue #6035

Closed
wants to merge 8 commits into from
Closed

Fix json issue #6035

wants to merge 8 commits into from

Conversation

yurisasuke
Copy link
Member

@yurisasuke yurisasuke commented Feb 27, 2025

User description

For internal users - Please add a Jira DX PR ticket to the subject!



Preview Link


Description


Screenshots (if appropriate)


Checklist

  • I have added a preview link to the PR description.
  • I have reviewed the suggestions made by our AI (PR Agent) and updated them accordingly (spelling errors, rephrasing, etc.)
  • I have reviewed the guidelines for contributing to this repository.
  • I have read the technical guidelines for contributing to this repository.
  • Make sure you have started your change off our latest master.
  • For Tyk Members - Please add a Jira DX PR ticket to the subject!
  • For Tyk Members - I have added the appropriate release label to this PR:
    • If it is for a future release, label it as future-release and specify the version (e.g., future-release, 6.0).
    • If it should be merged into an older version, use the specific version label (e.g., 4.1, 5.1).
    • If no label is added, it will be assumed that the PR should be merged into the latest current version (e.g., 5.5) and master.

PR Type

Enhancement, Bug fix


Description

  • Updated JSON-LD structured data script for schema.org compliance.

  • Added datePublished and dateModified fields for better metadata.

  • Improved author and copyrightHolder fields with structured organization data.

  • Fixed formatting and alignment issues in the JSON-LD script.


Changes walkthrough 📝

Relevant files
Enhancement
site_schema.html
Enhanced JSON-LD script with metadata and formatting fixes

tyk-docs/themes/tykio/layouts/partials/site_schema.html

  • Updated @context to use https://schema.org.
  • Added datePublished and dateModified fields.
  • Replaced plain text author and copyrightHolder with structured
    organization data.
  • Improved formatting and alignment of JSON-LD script.
  • +25/-12 

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Possible Syntax Issue

    Ensure that the JSON structure is valid and correctly formatted, especially with the added keywords array and its conditional logic.

    {{ if isset .Params "tags" }}
      {{ range $index, $tag := .Params.tags }}
        "{{ $tag }}"{{ if ne $index (sub (len .Params.tags) 1) }},{{ end }}
      {{ end }}
    {{ end }}
    Date Format Consistency

    Verify that the datePublished and dateModified formats are correct and consistent with the expected ISO 8601 standard.

    "datePublished": "{{ .Date.Format "2025-02-26" }}",
    "dateModified": "{{ .Lastmod.Format "2006-02-26" }}"

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use ISO 8601 format for dates

    Ensure that the dateModified field uses the correct date format to avoid potential
    parsing issues, as the format "2006-02-26" might not align with the expected ISO
    8601 standard.

    tyk-docs/themes/tykio/layouts/partials/site_schema.html [30]

    -"dateModified": "{{ .Lastmod.Format "2006-02-26" }}"
    +"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}"
    Suggestion importance[1-10]: 9

    __

    Why: The suggestion improves the date format to comply with the ISO 8601 standard, which is widely used and ensures compatibility with various systems. This change is highly relevant and impactful for maintaining proper data formatting.

    High
    General
    Handle missing tags gracefully in JSON

    Validate that the keywords field properly handles cases where .Params.tags is not
    defined to avoid generating invalid JSON.

    tyk-docs/themes/tykio/layouts/partials/site_schema.html [22-27]

     "keywords": [
       {{ if isset .Params "tags" }}
         {{ range $index, $tag := .Params.tags }}
           "{{ $tag }}"{{ if ne $index (sub (len .Params.tags) 1) }},{{ end }}
         {{ end }}
    +  {{ else }}
    +    "No tags available"
       {{ end }}
     ],
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion addresses a potential issue where the keywords field could generate invalid JSON if .Params.tags is not defined. By adding a fallback, it ensures robustness and prevents errors, which is a significant improvement.

    Medium

    Copy link

    netlify bot commented Feb 27, 2025

    PS. Pls add /docs/nightly to the end of url

    Name Link
    🔨 Latest commit c1e50c3
    🔍 Latest deploy log https://app.netlify.com/sites/tyk-docs/deploys/67c0052695d8df00082719c3
    😎 Deploy Preview https://deploy-preview-6035--tyk-docs.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link

    netlify bot commented Feb 27, 2025

    PS. Pls add /docs/nightly to the end of url

    Name Link
    🔨 Latest commit 8768ff1
    🔍 Latest deploy log https://app.netlify.com/sites/tyk-docs/deploys/67c006c7ef91b10008129bfc
    😎 Deploy Preview https://deploy-preview-6035--tyk-docs.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    @yurisasuke yurisasuke added the now label Feb 27, 2025
    @yurisasuke yurisasuke changed the base branch from master to letzya-structured-data February 27, 2025 06:38
    {
    "@context": "https://schema.org",
    {
    "@context" : "http://schema.org",
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    @letzya letzya force-pushed the letzya-structured-data branch from 8a976bb to 84f1892 Compare February 27, 2025 20:08
    @letzya
    Copy link
    Collaborator

    letzya commented Feb 27, 2025

    Closing. dont think it's needed

    @letzya letzya closed this Feb 27, 2025
    @letzya letzya deleted the fix-json-issue branch February 27, 2025 21:26
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants