Skip to content

Commit

Permalink
RSS Feed XML - handle description better (#491)
Browse files Browse the repository at this point in the history
handle empty description in articles json when creating the XML feed
  • Loading branch information
cderv authored Aug 28, 2023
1 parent 66ead96 commit ac5e3bf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# distill (development version)

- RSS feed creation now works correctly for listings when no `description` is provided in one of the Rmd post (thanks, \@cpsyctc, \@apeterson91, #490, #448).
- Fix an issue with line numbering on code chunks when `highlight-downlit: false` by tweaking Pandoc's default CSS rules (thanks, \@SES-CE, #473).
- Internally use `format()` instead of `as.character()` with Dates to account for argument \`format=\` deprecation in R 4.3.0 (thanks, \\\@mbojan, #488).
- Add a `subtitle` variable in HTML template placed between title and categories (thanks, \\\@dicook, #480).
- Internally use `format()` instead of `as.character()` with Dates to account for argument `format=` deprecation in R 4.3.0 (thanks, \@mbojan, #488).
- Add a `subtitle` variable in HTML template placed between title and categories (thanks, \@dicook, #480).

# distill 1.5 (CRAN)

Expand Down
5 changes: 1 addition & 4 deletions R/publish.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
#'
#' Publish a website to RStudio Connect
#'
#' @inheritParams rsconnect::deploySite
#' @inheritParams rsconnect::deployApp
#'
#' @param site_dir Directory containing website. Defaults to current working directory.
#' @param site_name Name for the site (names must be unique within an account). Defaults
#' to the `name` provided in `_site.yml` (or to the name of the site_dir if there is no
#' `name` specified).
#' @param account Account to deploy application to. This parameter is only required for
#' the initial deployment of an application when there are multiple accounts configured
#' on the system.
#' @param method Publishing method (currently only "rsconnect" is available)
#' @param render `TRUE` to render the site locally before publishing.
#' @param launch_browser If `TRUE`, the system's default web browser will be launched
Expand Down
2 changes: 1 addition & 1 deletion R/sitemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ write_feed_xml <- function(feed_xml, site_config, collection, articles) {
}
}
else {
add_child(item, "description", text = not_null(article$description, default = article$title))
add_child(item, "description", text = not_null_or_empty(article$description, default = article$title))
}

if (!is.null(article$categories)) {
Expand Down
7 changes: 7 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ not_null <- function(x, default="") {
x
}

not_null_or_empty <- function(x, default="") {
if (is.null(x) || length(x) == 0)
default
else
x
}

block_class = function(x){
if (length(x) == 0) return()
classes = unlist(strsplit(x, '\\s+'))
Expand Down
9 changes: 4 additions & 5 deletions man/publish_website.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac5e3bf

Please sign in to comment.