Merge branch 'tag-cloud-tpl-fix' into 'dev'

Add tpl for tagcloud and directory keyword cloud

See merge request hubzilla/core!2216
This commit is contained in:
Mario
2025-07-23 07:53:10 +00:00
4 changed files with 40 additions and 11 deletions

View File

@@ -484,11 +484,14 @@ function wtagblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restri
intval($uid)
);
$o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
foreach($r as $rr) {
$o .= '<span class="tag' . $rr[2] . '">#</span><a href="channel/' . $c[0]['channel_address'] . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n";
}
$o .= '</div></div>';
$channel = App::get_channel();
$url = z_root() . '/channel/' . $channel['channel_address'].'/?f=&tag=';
$tpl = get_markup_template('tagcloud.tpl');
$o .= replace_macros($tpl, [
'$title' => t('Tags'),
'$baseurl' => $url,
'$tags' => $r,
]);
}
return $o;
@@ -564,13 +567,14 @@ function dir_tagblock($link,$r) {
$r = App::$data['directory_keywords'] ?? [];
if($r) {
$o = '<div class="dirtagblock widget"><h3>' . t('Keywords') . '</h3><div class="tags" align="center">';
foreach($r as $rr) {
$o .= '<a href="'.$link .'/' . '?f=&keywords=' . urlencode($rr['term']).'" class="tag'.$rr['normalise'].'" rel="nofollow" >'.$rr['term'].'</a> ' . "\r\n";
}
$o .= '</div></div>';
$url = $link . '/?f=&keywords=';
$tpl = get_markup_template('dirtagcloud.tpl');
$o .= replace_macros($tpl, [
'$title' => t('Keywords'),
'$baseurl' => $url,
'$tags' => $r,
]);
}
return $o;
}

View File

@@ -14,8 +14,13 @@
.tags {
word-wrap: break-word;
display: flex;
justify-content: center;
}
.tag {
margin-right: 0.3rem;
}
.widget-nav-pills-icons {
opacity: 0;
float: right;

10
view/tpl/dirtagcloud.tpl Normal file
View File

@@ -0,0 +1,10 @@
<div class="dirtagblock widget">
<h3>{{$title}}</h3>
<div class="tags">
{{foreach $tags as $tag}}
<span class="tags">#</span><a href="{{$baseurl}}{{$tag['term']}}" class="tag tag{{$tag['normalise']}} me-1" rel="nofollow">{{$tag['term']}}</a>
{{/foreach}}
</div>
</div>

10
view/tpl/tagcloud.tpl Normal file
View File

@@ -0,0 +1,10 @@
<div class="tagblock widget">
<h3>{{$title}}</h3>
<div class="tags">
{{foreach $tags as $tag}}
<span class="tag{{$tag[2]}}">#</span><a href="{{$baseurl}}{{$tag[0]}}" class="tag tag{{$tag}}">{{$tag[0]}}</a>
{{/foreach}}
</div>
</div>