Closed ghost closed 5 years ago
@7pedroruizzz Hi! Any variables you add are available in the templates 👍🏻
e.g. <%=page.color%>
Some themes rename page
to post
and etc.
@tcrowe
@jodumont
Hello!
I know, but I need these custom variables in a tagcloud widget.
Currently I have the tag-plugin
installed and working:
<% if (site.tags.length){ %>
<div class="m_widget tagcloud">
<h5>Tags</h5>
<div class='content'>
<%- tagcloud(site.tags, {
min_font: 14,
max_font: 14,
}) %>
</div>
</div>
<% } %>
This is a tagcloud tags
.
What I need is "in addition" another tagcloud
with only my custom post.variable
namely color
(= as defined as a post.variable in my .md files).
So the color
tagcloud shows green
, blue
,yellow
, etc. and works the same way as the "original" tagcloud with tags.
Makes sense and possible to accomplish (without going into the Hexo core to make tweaks?)?
Sounds interesting
We can accomplish with front matter Yaml list:
color:
- green
- blue
- yellow
Can you try it then msg back?
I hope that worked, @7pedroruizzz.
If not please re-open this and we can find another solution. 👍🏻
Tags plugin works good, but I need other more variables that filter out my blogposts. For example, "color" variable. My .md:
And another post has .md:
My plan is to create a widget (same look and feel as a tagcloud) that grabs all my custom post variables ("color" cloud"), and then when user clicks "green" for example, the blogpost with
title: bye
filters out.Anybody tried this before? Any clues how to go about this? I am a bit worried as I feel I have to go into the core of hexo and write a new plugin for this. Or can I just copy/rename the whole "tagcloud plugin" from
tag
tocolor
for example and do this for multiple custom variables?