Filtering by Title as Tag

Hi there,

I already have the content on my site tagged for other uses and I’m working on a specific use within that where I want to be abel to tag by just the title of the page to create links between specific pages.

I have two “tags” fields with custom names searching the title field of other pages

    label: Tag for Relevant Work
    type: tags
    lower: true
    index: all 
    field: title
    width: 1/2
  worktitle2:
    label: Tag for Relevant Setting
    type: tags
    lower: true
    index: all 
    field: title
    width: 1/2

In my template I would like to use something like:

<?php foreach($site->index()->filterBy('title',  '<?php echo $presentation->worktitle() ?>') as $linkedwork): ?>

within a foreach loop of the various $presentations i’m trying to link to so that I can pull the title of the linked page as well as its url. This isn’t working, but is also not throwing me any error messages, so I’m a bit lost.

The tags seem to be pulling fine and it searches through the titles of the pages (there are a lot), but I can’t seem to figure out how to use this “tag” in the template.

Many thanks for any advice on this!

You code won’t work like that.

<?php 
$tag = $presentation->worktitle();
foreach($site->index()->filterBy('title', $tag, ',') as $linkedwork): ?>

Amazing. Thank you Sonja, I knew I was missing some key component, and I tell you I tried all sorts of variations of the above.

This one didn’t quite work either, but I removed the ```lower: true from the blueprint and now it works perfectly.