Hi all,
I currently have a feed of photos, and I would like to use tags to dictate their URL, add a page title and then define what photos show (based on the tag used).
My code for the correct page title in my photos.php template is:
<?php if(param('tag')): ?>
<h2 class="fadeIn h1 m0 mb3 p0 tag"><?php $tag = param('tag'); echo $tag ?><h2>
<?php else: ?>
<h2 class="fadeIn h1 m0 mb3 p0 tag"><?php echo $page->title() ?></h2>
<?php endif ?>
The code I’m using for filtering by tag is:
<?php $projects = page('photos')->children()->visible()->filterBy('tags', param('tag'), ',')->sortBy('date', 'desc'); ?>
<div class="feed relative z2">
<?php foreach($projects as $project): ?>
<article class="mb3">
<section class="flex flex-wrap items-center">
<?php foreach($project->images()->sortBy('sort', 'asc') as $image): ?>
<figure class="m0 p0">
<img class="b-lazy block max-width" src="<?= $image->url() ?>" alt="<?= $page->title()->html() ?>" />
</figure>
<?php endforeach ?>
</section>
</article>
<?php endforeach ?>
I can’t, however, get the URL slug to remove the tag:
and I’d like to remove the parent folder from the URL too.
Cheers!