aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-07-25 21:50:06 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-07-25 22:28:41 +0200
commit4bfa321f784683cef90f63f83d1aa7fe741a196e (patch)
tree9f034f8db7658b6f355195c29d750dbe53517866 /src/blogc-make
parent008b956ba609bf30d8c6f44c36d9f11cdc493bc2 (diff)
downloadblogc-4bfa321f784683cef90f63f83d1aa7fe741a196e.tar.gz
blogc-4bfa321f784683cef90f63f83d1aa7fe741a196e.tar.bz2
blogc-4bfa321f784683cef90f63f83d1aa7fe741a196e.zip
make: implemented atom_legacy_entry_id setting
This allows current users to avoid atom entry id changes.
Diffstat (limited to 'src/blogc-make')
-rw-r--r--src/blogc-make/atom.c12
-rw-r--r--src/blogc-make/settings.c1
2 files changed, 12 insertions, 1 deletions
diff --git a/src/blogc-make/atom.c b/src/blogc-make/atom.c
index ae5e0c1..b953876 100644
--- a/src/blogc-make/atom.c
+++ b/src/blogc-make/atom.c
@@ -84,11 +84,21 @@ bm_atom_deploy(bm_settings_t *settings, bc_error_t **err)
char *post_url = bm_generate_filename(NULL, post_prefix, "{{ FILENAME }}",
post_ext);
+ char *entry_id = NULL;
+ if (bc_str_to_bool(bc_trie_lookup(settings->settings, "atom_legacy_entry_id"))) {
+ entry_id = bc_strdup_printf("%s%s/{{ FILENAME }}/",
+ post_prefix[0] == '\0' ? "" : "/", post_prefix);
+ }
+ else {
+ entry_id = bc_strdup(post_url);
+ }
+
char *content = bc_strdup_printf(atom_template, atom_url->str, atom_url->str,
- post_url, post_url);
+ entry_id, post_url);
bc_string_free(atom_url, true);
free(post_url);
+ free(entry_id);
if (-1 == write(fd, content, strlen(content))) {
*err = bc_error_new_printf(BLOGC_MAKE_ERROR_ATOM,
diff --git a/src/blogc-make/settings.c b/src/blogc-make/settings.c
index 2029199..719afe1 100644
--- a/src/blogc-make/settings.c
+++ b/src/blogc-make/settings.c
@@ -43,6 +43,7 @@ static const struct default_settings_map {
{"atom_prefix", "atom"},
{"atom_ext", ".xml"},
{"atom_order", "DESC"},
+ {"atom_legacy_entry_id", NULL},
// generic
{"date_format", "%b %d, %Y, %I:%M %p GMT"},