If some URLs are already included in the database, it appends only the new ones: URLs are expected to be unique.
Usage
cas_write_db_sitemap(
sitemap,
overwrite = FALSE,
db_connection = NULL,
disconnect_db = FALSE,
...
)Arguments
- sitemap
A sitemap url, or a dataframe with at least one column named
sitemap_url.- overwrite
Logical, defaults to FALSE. If TRUE, checks if matching data are previously held in the table and overwrites them. This should be used with caution, as it may overwrite completely the selected table.
- db_connection
Defaults to NULL. If NULL, uses local SQLite database. If given, must be a connection object or a list with relevant connection settings (see example).
- disconnect_db
Defaults to TRUE. If FALSE, leaves the connection to database open.
- ...
Passed to
cas_get_db_file().
Examples
cas_set_options(
base_folder = fs::path(fs::path_temp(), "R", "castarter_data"),
db_folder = fs::path(fs::path_temp(), "R", "castarter_data"),
project = "example_project",
website = "example_website"
)
cas_enable_db()
cas_write_db_sitemap(sitemap = "https://example.com/sitemap.xml")
#> ℹ No new url added to sitemap table.
cas_read_db_sitemap()
#> # Source: table<`sitemap`> [?? x 1]
#> # Database: sqlite 3.51.2 [/tmp/RtmprKtXJ9/R/castarter_data/cas_example_project_example_website_db.sqlite]
#> sitemap_url
#> <chr>
#> 1 https://example.com/sitemap.xml