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

chore(components) github discussions #240

Conversation

StephenHill-NHSBSA
Copy link
Contributor

@WORTI3 Any guidance you can give would be gratefully appreciated! 💪

@aircwo aircwo force-pushed the 222-update-all-suggest-a-change-to-this-page-footer-links-to-point-to-github-discussions-instead-of-issues branch 2 times, most recently from 7ad0c23 to 467259d Compare October 17, 2023 15:02
@aircwo aircwo changed the title Initial commit chore(components) github discussions Oct 18, 2023
@aircwo
Copy link
Contributor

aircwo commented Oct 18, 2023

@StephenHill-NHSBSA I've added some code to extract the category from the file path and use that in the URL. This should do what you wanted 😄
The "unified" categories are completely configurable so if we need to update any in the future thats easily done.

{{ appGithubDiscussion({
  catagory: page.filePathStem | extractCategory("general-playbook-ideas", ['development', 'security', 'testing'], { 
technologies: 'development', design: 'UCD', research: 'UCD' }) | safe,
  template: "General-Playbook-Ideas.md",
  title: "Change to page '" + page.filePathStem + "' ",
  linkText: "Suggest a change to this page"
}) }}

@aircwo aircwo marked this pull request as ready for review October 18, 2023 12:08
@yantantether
Copy link
Contributor

yantantether commented Oct 27, 2023

@WORTI3 , I think it may be a bit too fragile to rely on the path.

We could add 11ty template directory data files, and use that?

This allows us

  • ability to specify/share categories regardless of folder
  • able to categorise differently for subfolders. e.g. development/secure.md could be discussed in security
  • more opportunity to allow linking to specific discussions in page frontmatter.

https://www.11ty.dev/docs/data-template-dir/

e.g.

  • given a folder: src/development
  • add a template dir data file development.11ty.data.json
{
    "discussion": {
        "category": "development"
    }
}

and in front matter to choose a specific discussion:

---
discussion:
    id: 123
---

@aircwo
Copy link
Contributor

aircwo commented Oct 30, 2023

@WORTI3 , I think it may be a bit too fragile to rely on the path.

We could add 11ty template directory data files, and use that?

This allows us

  • ability to specify/share categories regardless of folder
  • able to categorise differently for subfolders. e.g. development/secure.md could be discussed in security
  • more opportunity to allow linking to specific discussions in page frontmatter.

https://www.11ty.dev/docs/data-template-dir/

e.g.

  • given a folder: src/development
  • add a template dir data file development.11ty.data.json
{
    "discussion": {
        "category": "development"
    }
}

and in front matter to choose a specific discussion:

---
discussion:
    id: 123
---

I think this would also make the component code simpler (not that its used anywhere else).

@aircwo
Copy link
Contributor

aircwo commented Oct 30, 2023

@yantantether removed filter in favour of using 11tydata files.
Could look to utilise 11tydata files more as they seem really useful.

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.

Update all 'Suggest a change to this page' footer links to point to GitHub 'discussions' instead of 'issues'
3 participants