How to check if the topic tags include tag id is abczxyz?

This my code:

<% if ( @topic_view.topic.tags.length > 0 and @topic_view.topic.tags.include? "abcxyza" ) %>
SOME THING
<% else %>

Full code: here

And is it wrong to make the site inaccessible?

Can you give me the correct code to check that article tags have an id tag named “abcxyz”?

1 Like

Out of interest why are you using an erb file and not an hbs file?

Normally you would use an hbs template within a connector.

1 Like

I am not good at coding so I have followed another plugin with the function that may interfere with the connectors.

So if you write it on hbs file will things be easier?

I could be wrong but connectors are ember components so you actually need to change your directory structure here to match a discourse ember structure as well. I would look at existing official or pavilion plugins for examples.

Then again if you are stuck on server side rendering because of ‘amp’ you may need a different approach closer to what you are already doing. However I’m not sure connectors work in that scenario? - I’m not your best advisor here and will open that up to the house. :slight_smile:

Connectors seem to also be supported for server side rendered erb files.

1 Like

Which plugin was this out of interest?

is: discourse-ratings/aggregate_rating.html.erb at main · paviliondev/discourse-ratings · GitHub

I just see how to insert an html clip into a topic and it still shows when viewing source. Previously I wanted to insert on the engine

Thanks. I stand corrected. Looks like you can.

1 Like

I’m trying to see what it is

<%= @topic_view.topic.inspect %>
<%= @topic_view.topic.tags.inspect %>
<%= @topic_view.topic.tags[0].inspect %>

Thank you.

I don’t know, testing the code and running it takes a long time … 90% of the time is waiting

1 Like

You cannot run it locally to test it? Always good to test something locally first before deploying. As you say, time.

1 Like

Everything is done and I find myself stupid: D Instead of using $value[“key”] I use $value.key :))

You cannot run it locally to test it? => I created a new server and tested it.

Thank you very much, good day. @merefield

2 Likes

Very well done @Bcat!

2 Likes