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

Add enum for MetaTag properties and names outlined in #348. #373

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

JPToroDev
Copy link
Collaborator

No description provided.

}

/// Metadata properties for social media sharing.
public enum Property: String, Sendable {
Copy link
Owner

Choose a reason for hiding this comment

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

The distinction between Name and Property seems like a bagatelle, and means folks need to select the correct initializer in order to see code completion for the things they care about. Could we merge all these into a single enum, then use a computed property to return the key string based on a switch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Excellent idea! Will revise 🙌🏼

Comment on lines 13 to 34
/// Metadata names for social media cards.
public enum Name: String, Sendable {
/// The image to display in Twitter cards.
case twitterImage = "twitter:image"
/// The title to display in Twitter cards.
case twitterTitle = "twitter:title"
/// The domain to display in Twitter cards.
case twitterDomain = "twitter:domain"
/// The type of Twitter card to use.
case twitterCard = "twitter:card"
/// Whether to disable Twitter tracking.
case twitterDoNotTrack = "twitter:dnt"
/// The description to display in Twitter cards.
case twitterDescription = "twitter:description"
/// The software used to generate the document.
case generator
/// The viewport configuration for responsive web design.
case viewport

/// The meta attribute key.
var key: String { "name" }
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the introduction of some more public-facing enums and decided to create #380. I'd like to have a conversation there to decide whether or not this is something we want to do instead

@twostraws
Copy link
Owner

Perfect – thank you!

@twostraws twostraws merged commit 157f3de into twostraws:main Jan 28, 2025
1 check passed
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.

3 participants