Forum
Meta Data in portfolio detail page
Hi, How would you change the meta data for each portfolio item if you have created a protfolio thorugh the perch_content_custom tags? I have used the the below code for the detail pages but obviously there no page details each portfolio item. Thanks!
<?php
include('admin/runtime.php');?>
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>John Mark Films - Luxurious, creative, inspiring wedding videos</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Font -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/elegant-font.css">
<link rel="stylesheet" href="css/linearicons.css">
<!-- REVOLUTION STYLE SHEETS -->
<link rel="stylesheet" type="text/css" href="revolution/css/settings.css">
<!-- REVOLUTION LAYERS STYLES -->
<link rel="stylesheet" type="text/css" href="revolution/css/layers.css">
<!-- REVOLUTION NAVIGATION STYLES -->
<link rel="stylesheet" type="text/css" href="revolution/css/navigation.css">
<!-- OWL CAROUSEL
================================================== -->
<link rel="stylesheet" href="css/owl.carousel.css">
<!-- SCROLL BAR MOBILE MENU
================================================== -->
<?php
$domain = 'https://'.$_SERVER["HTTP_HOST"];
$url = $domain.$_SERVER["REQUEST_URI"];
$sitename = "John Mark Films";
$twittername = "@johnmarkfilms";
$sharing_image = '/images/collection.jpg';
PerchSystem::set_var('domain',$domain);
PerchSystem::set_var('url',$url);
PerchSystem::set_var('sharing_image',$sharing_image);
PerchSystem::set_var('twittername',$twittername);
perch_page_attributes(array(
'template' => 'default.html'
));
?>
<link rel="stylesheet" href="css/jquery.mCustomScrollbar.css" />
<!-- Main Style -->
<link rel="stylesheet" href="style.css">
<!-- color scheme -->
<link rel="stylesheet" href="switcher/demo.css" type="text/css">
<link rel="stylesheet" href="switcher/colors/yellow.css" type="text/css" id="colors">
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="favicon.png">
</head>
<body>
<?php include('includes/analyticstracking.php'); ?>
<?php include('includes/navigation.php');?>
<?php perch_content_custom('Weddings', array(
'page'=>'/films.php',
'template'=> 'wedding_detail.html',
'filter' => 'slug',
'match' => 'eq',
'value' => perch_get('s'),
'count' => 1,
));?>
<?php include('includes/latest-projects.php');?>
<?php include('includes/footer.php');?>
You could add the fields to your portfolio item and then display them in the head using their own template.
So add them as extra fields on the portfolio item? How would I then show them in the head?
You could do it like this:
So from that, in the portfolio_detail.html page I've now added the follwing to the bottom of the page.
How would I then get these attibutes into the head section of the page? And if that's with perch_layout_var can you let me know how that works because I'm not too sure how to use it
In the head of your page use
perch_content_custom()
to display the region, using a template with just those meta tags in it.Thanks Drew, that worked well!