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

[Feature]: Default <meta> metadata HTML tags #4

Open
jimbrig opened this issue Jun 13, 2024 · 0 comments
Open

[Feature]: Default <meta> metadata HTML tags #4

jimbrig opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
feature New enhancements and features.

Comments

@jimbrig
Copy link
Member

jimbrig commented Jun 13, 2024

#' Use No Clocks `<meta>`
#'
#' @description
#' Adds `<meta>` tags and social media cards for No Clocks, LLC.
#'
#' @param name (character) The name of the site
#' @param version (character) The version of the site
#' @param description (character) The description of the site
#' @param url (character) The URL of the site
#' @param theme_color (character) The theme color of the site
#' @param robots (character) The robots meta tag
#' @param generator (character) The generator meta tag
#' @param subject (character) The subject meta tag
#' @param rating (character) The rating meta tag
#' @param referrer (character) The referrer meta tag
#' @param csp (character) The content security policy meta tag
#' @param image (character) The image URL for the site
#' @param image_alt (character) The image alt text for the site
#' @param twitter_creator (character) The Twitter creator meta tag
#' @param twitter_card_type (character) The Twitter card type meta tag
#' @param twitter_site (character) The Twitter site meta tag
#' @param ... Additional arguments
#'
#' @seealso [metathis::meta()]
#'
#' @return HTML via [htmltools::tags()] and `<meta>` tags via
#'   [metathis::meta()]
#' @export
#'
#' @example examples/ex_use_noclocks_meta.R
#'
#' @importFrom metathis meta meta_social
use_noclocks_meta <- function(
    name = "noclocks",
    version = "0.0.1",
    description = "<meta> and social media cards for No Clocks, LLC",
    url = "https://noclocks.dev",
    theme_color = "#000000",
    robots = "index,follow",
    generator = "R-Shiny",
    subject = "No Clocks, LLC",
    rating = "General",
    referrer = "origin",
    csp = "default-src 'self'",
    image = noclocks_logo(url = TRUE),
    image_alt = "No Clocks, LLC Logo",
    twitter_creator = "@noclocksdev",
    twitter_card_type = "summary_large_image",
    twitter_site = "@noclocksdev",
    ...
) {

  # noclocks_brand()$colors |> dplyr::filter(type == "dark") |> dplyr::pull(hex)

  htmltools::tags$head(
    metathis::meta() |>
      metathis::meta_viewport(maximum_scale = 1) |>
      metathis::meta_general(
        application_name = name,
        theme_color = theme_color,
        description = description,
        robots = robots,
        generator = generator,
        subject = subject,
        rating = rating,
        referrer = referrer
      ) |>
      metathis::meta_tag(
        "http-equiv" = "Content-Security-Policy",
        "content" = csp
      ) |>
      metathis::meta_name(
        "package" = name,
        "version" = version
      ) |>
      metathis::meta_social(
        title = name,
        description = description,
        url = url,
        image = image,
        image_alt = image_alt,
        twitter_creator = twitter_creator,
        twitter_card_type = twitter_card_type,
        twitter_site = twitter_site
      )
  )

}
@jimbrig jimbrig added the feature New enhancements and features. label Jun 13, 2024
@jimbrig jimbrig self-assigned this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New enhancements and features.
Projects
None yet
Development

No branches or pull requests

1 participant