diff options
Diffstat (limited to 'src/blogc-make/atom.c')
-rw-r--r-- | src/blogc-make/atom.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/blogc-make/atom.c b/src/blogc-make/atom.c index d5f5387..0e4e631 100644 --- a/src/blogc-make/atom.c +++ b/src/blogc-make/atom.c @@ -20,11 +20,11 @@ static const char atom_template[] = "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n" " <title type=\"text\">{{ SITE_TITLE }}{%% ifdef FILTER_TAG %%} - " "{{ FILTER_TAG }}{%% endif %%}</title>\n" - " <id>{{ BASE_URL }}/%s{%% ifdef FILTER_TAG %%}/{{ FILTER_TAG }}" + " <id>{{ BASE_URL }}%s%s{%% ifdef FILTER_TAG %%}/{{ FILTER_TAG }}" "{%% endif %%}%s</id>\n" " <updated>{{ DATE_FIRST_FORMATTED }}</updated>\n" " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/\" />\n" - " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/%s{%% ifdef FILTER_TAG %%}" + " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}%s%s{%% ifdef FILTER_TAG %%}" "/{{ FILTER_TAG }}{%% endif %%}%s\" rel=\"self\" />\n" " <author>\n" " <name>{{ AUTHOR_NAME }}</name>\n" @@ -34,10 +34,10 @@ static const char atom_template[] = " {%% block listing %%}\n" " <entry>\n" " <title type=\"text\">{{ TITLE }}</title>\n" - " <id>{{ BASE_URL }}/%s/{{ FILENAME }}/</id>\n" + " <id>{{ BASE_URL }}%s%s/{{ FILENAME }}/</id>\n" " <updated>{{ DATE_FORMATTED }}</updated>\n" " <published>{{ DATE_FORMATTED }}</published>\n" - " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}/%s/{{ FILENAME }}/\" />\n" + " <link href=\"{{ BASE_DOMAIN }}{{ BASE_URL }}%s%s/{{ FILENAME }}/\" />\n" " <author>\n" " <name>{{ AUTHOR_NAME }}</name>\n" " <email>{{ AUTHOR_EMAIL }}</email>\n" @@ -66,9 +66,12 @@ bm_atom_deploy(bm_settings_t *settings, bc_error_t **err) const char *atom_prefix = bc_trie_lookup(settings->settings, "atom_prefix"); const char *atom_ext = bc_trie_lookup(settings->settings, "atom_ext"); const char *post_prefix = bc_trie_lookup(settings->settings, "post_prefix"); + const char *atom_slash = atom_prefix[0] == '\0' ? "" : "/"; + const char *post_slash = post_prefix[0] == '\0' ? "" : "/"; - char *content = bc_strdup_printf(atom_template, atom_prefix, atom_ext, - atom_prefix, atom_ext, post_prefix, post_prefix); + char *content = bc_strdup_printf(atom_template, atom_slash, atom_prefix, + atom_ext, atom_slash, atom_prefix, atom_ext, post_slash, post_prefix, + post_slash, post_prefix); if (-1 == write(fd, content, strlen(content))) { *err = bc_error_new_printf(BLOGC_MAKE_ERROR_ATOM, |