aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/atom.c
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/atom.c
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/atom.c')
-rw-r--r--src/blogc-make/atom.c12
1 files changed, 11 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,