summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generators.c28
-rw-r--r--sample/src/setup.xml3
-rw-r--r--setup.c4
-rw-r--r--setup.h2
-rw-r--r--templates/template-album.tmpl2
-rw-r--r--templates/template-index.tmpl2
-rw-r--r--templates/template-view_photo.tmpl2
7 files changed, 39 insertions, 4 deletions
diff --git a/generators.c b/generators.c
index 6bcf637..d4b0cf9 100644
--- a/generators.c
+++ b/generators.c
@@ -342,6 +342,16 @@ write_html_album (TGallerySetup *setup,
/* Simple placeholders */
+ if (strstr (b, "<!-- $(PAGE_TITLE) -->")) {
+ if (items->parent_index == NULL || setup->site_title == NULL)
+ s1 = g_strdup (setup->site_title ? setup->site_title : items->ID);
+ else
+ s1 = g_strdup_printf ("%s | %s", items->title, setup->site_title);
+ s2 = g_markup_escape_text (s1, -1);
+ str_replace (&b, "<!-- $(PAGE_TITLE) -->", s2, NULL);
+ g_free (s2);
+ g_free (s1);
+ }
if (strstr (b, "<!-- $(ID) -->") && items->ID) {
s1 = g_strdup (items->ID);
fix_entities (&s1);
@@ -727,7 +737,23 @@ write_html_image (TGallerySetup *setup,
str_replace (&title_desc, "\n", "<br />", NULL);
}
}
-
+ if (title) title = g_strstrip (title);
+ if (title_desc) title_desc = g_strstrip (title_desc);
+
+ /* Page title */
+ if (strstr (b, "<!-- $(PAGE_TITLE) -->")) {
+ s1 = (title && strlen (title) > 0) ? g_strdup_printf("%s | ", title) : NULL;
+ s2 = g_strdup_printf ("%s [%d/%d]", parent_items->title ? parent_items->title : parent_items->ID, real_item_index, real_total_items);
+ s3 = setup->site_title ? g_strdup_printf(" | %s", setup->site_title) : NULL;
+ s4 = g_strconcat (s1 ? s1 : "", s2, s3 ? s3 : "", NULL);
+ if (s1) g_free (s1);
+ if (s2) g_free (s2);
+ if (s3) g_free (s3);
+ s1 = g_markup_escape_text (s4, -1);
+ str_replace (&b, "<!-- $(PAGE_TITLE) -->", s1, NULL);
+ g_free (s4);
+ g_free (s1);
+ }
/* Simple placeholders */
if (strstr (b, "<!-- $(FILE_NAME) -->"))
str_replace (&b, "<!-- $(FILE_NAME) -->", imgname, NULL);
diff --git a/sample/src/setup.xml b/sample/src/setup.xml
index 234e8f0..2ebf0d0 100644
--- a/sample/src/setup.xml
+++ b/sample/src/setup.xml
@@ -54,6 +54,9 @@
<!-- (allowed values: "yes", "no") default = yes -->
<!-- this setting is independent from the global meta tags settings -->
<use_title_as_meta value="yes" />
+
+ <!-- mandatory site name, part of all page titles -->
+ <site title="CGG Testing Site" />
</meta>
<footer><![CDATA[
diff --git a/setup.c b/setup.c
index 627ee46..97f1e3c 100644
--- a/setup.c
+++ b/setup.c
@@ -127,6 +127,8 @@ parse_setup_xml (const char *filename, TGallerySetup *setup)
setup->use_title_as_meta = s ? strcasecmp (s, "yes") == 0 : TRUE; /* default to FALSE */
if (s) g_free (s);
+ setup->site_title = xml_file_get_node_attribute (xml, "/gallery_setup/meta/site", "title");
+
xml_parser_close (xml);
#ifdef __DEBUG_ALL__
@@ -248,6 +250,8 @@ free_setup_data (TGallerySetup *setup)
free (setup->meta_author);
if (setup->border_style)
free (setup->border_style);
+ if (setup->site_title)
+ free (setup->site_title);
free (setup);
setup = NULL;
}
diff --git a/setup.h b/setup.h
index bd0c319..a90f241 100644
--- a/setup.h
+++ b/setup.h
@@ -58,6 +58,8 @@ typedef struct {
gboolean preload;
gboolean use_iptc_exif;
gboolean erase_exif_thumbnail;
+
+ char *site_title;
} TGallerySetup;
diff --git a/templates/template-album.tmpl b/templates/template-album.tmpl
index 03bca5e..5c27ab5 100644
--- a/templates/template-album.tmpl
+++ b/templates/template-album.tmpl
@@ -2,8 +2,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>Browsing album "<!-- $(ID) -->"</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <title><!-- $(PAGE_TITLE) --></title>
<!-- $(CGG_META_TAGS) -->
<link href="styles.css" type="text/css" rel="stylesheet" media="screen, print" />
<script type="text/javascript" src="scripts-general.js"> </script>
diff --git a/templates/template-index.tmpl b/templates/template-index.tmpl
index 44fb508..a07ba05 100644
--- a/templates/template-index.tmpl
+++ b/templates/template-index.tmpl
@@ -2,8 +2,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>Photo index: <!-- $(ID) --></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <title><!-- $(PAGE_TITLE) --></title>
<!-- $(CGG_META_TAGS) -->
<link href="styles.css" type="text/css" rel="stylesheet" media="screen, print" />
<script type="text/javascript" src="scripts-general.js"> </script>
diff --git a/templates/template-view_photo.tmpl b/templates/template-view_photo.tmpl
index dafff32..d070a6e 100644
--- a/templates/template-view_photo.tmpl
+++ b/templates/template-view_photo.tmpl
@@ -2,8 +2,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>Viewing photo "<!-- $(FILE_NAME) -->" [<!-- $(FILE_NO) -->/<!-- $(TOTAL_ITEMS) -->]</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <title><!-- $(PAGE_TITLE) --></title>
<!-- $(CGG_META_TAGS) -->
<link href="styles.css" type="text/css" rel="stylesheet" media="screen, print" />
<script type="text/javascript" src="scripts-general.js"> </script>