Would like to use a photo’s filename as breadcrumb rather than title. Is this possible?
The only way I know of is to leave the metadata Title field blank. The image breadcrumb will then default to the filename.
There may be a phplugins solution but I don’t see a hook for breadcrumbs. Maybe @Matthew or @Daniel will have some ideas.
Thanks for the quick response, Rod. Was hoping for a solution other than not using the Title field. We make fairly extensive use of this field for photos we publish to Flickr, most of which are also published via Backlight. ![]()
There are other ways to display the filename. You can use the caption area or the metadata panel in the album template. You could also use that phplugins function I referenced to display the filename above the image (and below the breadcrumbs).
And, as I mentioned above, Matt or Daniel may have other solutions. I started thinking of a way to use jQuery to do it, but quickly got my brain tangled.![]()
You can use phplugins to create the breadcrumbs.
A while ago, I wrote about adding breadcrumbs to non-gallery pages: Adding breadcrumbs to non-gallery pages (updated August 2020) – lab.danielleu.com. This could serve as a starting place. You can use $_SERVER["REQUEST_URI"] to extract the gallery path and then create the breadcrumbs trail from there.
Hello Daniel,
I tried to implement the PHP code you suggested (as a starting point) but, not only it doesn’t do anything, but the favicon on the browser page tab changes from my logo to the host provider’s logo!
Here is how I wrote it:
//Outputs the breadcrumbs for the given page including the home page
/*function dlp_my_crumb( $page_name ) {
echo '<ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList"> <li class="fa_pseudo" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a href="/" itemprop="item"><span itemprop="name">Home</span></a> <meta itemprop="position" content="1" /> </li>
<li class="fa_pseudo" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" <span itemprop="name" position="2">'. $page_name .'</span> <meta itemprop="position" content="1" />
</li></ul>';
}
// returns true if $page matches current page or any of its
// sub-pages
function dlp_page_match($page) {
if (substr($_SERVER["REQUEST_URI"], 0, strlen($page)) == $page) {
return true;
} else {
return false;
}
}
/*function main_top(){
// Add breadcrumbs to non-gallery pages
if (strtolower($this->slug) == 'about') {
$this->dlp_my_crumb('About');
} else if (strtolower($this->slug) == 'contact') {
$this->dlp_my_crumb('Contact');
} elseif ($this->dlp_page_match('/backlight/search') ) {
$this->dlp_my_crumb('Search');
} else if (strtolower($this->slug) == 'xxxx') {
$this->dlp_my_crumb('Xxxx');
}
}*/
/*function single_bottom(){
// support for left/right arrow key and esc key navigation
$photo = $this->photo;
$album = $this->album;
echo' <script>
function checkKey(e) {
switch(e.which) {
case 37: ';
if ($album->getPreviousPhoto($photo)) {
echo 'location.href=$("li.single_image_prev a").attr("href");';
}
echo 'break;
case 39:';
if ($album->getNextPhoto($photo)) {
echo 'location.href=$("li.single_image_next a").attr("href");';
}
echo 'break;
case 27:';
echo 'location.href=$("li.single_image_back a").attr("href");';
echo 'break;
default: return;
}
e.preventDefault();
}
document.onkeydown = checkKey;
</script>';
}
function ttg_user_load( $style, $path ) {
$g_tsvrl = explode( ' ', $style ); // Extract gallery type
define ( 'G_STYLE', strtoupper($g_tsvrl[1]) ); // and set global for later
$g_path = str_ireplace('\\','/',$path); // change \ to /
$chunks = explode('/',$g_path); // and put into array
define ( 'G_PATH', strtoupper($chunks[count($chunks)-2]) ); // gallery folder name is second to last
//define ( 'TTG_SITE', ''); // set new site root for navigation, resources, etc.
}
// END
function ttg_head( $style, $path ) {
echo '
<link rel="stylesheet" href="https://pideja.ca/custom/css/neopideja.css" />
';
}*/
So, I decided to remove it and also remove all the titles in Lightroom so the thumbnails now indicate the large image file name.
Not your fault, I just don’t kmow enough about PHP to play with it successfully.
A few things I noticed:
You’re putting Daniel’s code at the top of the file and not in the user area.
You’re using the old phplugins file. Always start with the phplugins-pangolin-sample.php file
And this bit: function ttg_head( $style, $path ) is syntax from the old phplugins
Sorry, I was out on vacation. Did you find a solution to your issue?