How to tags()->offset()?

Hi everyone. I was wondering how I can achieve the same result of $page->offset() but with tags. I want to pass the first tag.

I haven’t tested this, but can’t you limit() the tags?


    $tag = $page->tags()->limit(1);

1 Like

You need to transform your tags to an array first using split
Tags() is just a field.

Once you have your array you can use limit(1) or even easier first()

1 Like

You can’t use collection methods on an array, but the methods from the ‘A’ class will do the job in this case:

$tags = $page->tags()->split(',');
$first = a::first($tags);
2 Likes

Thank you all for your answers!
Best regards!