Ghost Pro - How do you hide articles from code injection?

How to hide articles with a specific tag using Code injection?
Theme: Casper
Ghost Pro 4.13.0

If you mean post-cards then you can do it like this:

<style>
.post-card.tag-getting-started {
    display: none;
}
</style>

In this example, the post-cards with the tag “Getting started” will be hidden.

1 Like

Does anyone know how to do this with code injection in Edge?
If I try and hide the all posts with:

<style>
.post-link {
 display:none
}
</style>

…on a custom feed page, with code injection it doesn’t work for me (although it does work if I use this code directly in a browser with Firebug in Firefox for example. It seems that some code in screen.css can’t be code injected from the dashboard page. Is this because of gulp?

It definitely should be possible with code injection. Did you add the code in the custom page’s code injection or in the general site code injection? Try the second option.

It’s working from the main code injection but not from a custom page code injection, I want it to work from the custom page injection so I can edit the page styles individually. Is this anything to do with the code in the .hbs template?

I’ve discovered that you can add styles to the .hbs template files and this is a workaround in getting custom code in these pages, but it’s not ideal that way…

This might be related to this topic:

But as an alternative, you can target specific pages from the site code injection, the <body> will have a page-specific class. For example, in the demo, the Style guide page will have a page-style-guide class on the body. So in you code injection you can do this:

<style>
.page-style-guide .post-link {
   display:none
}
</style>

ok thanks for the link, yes it’s probably more relevant to that thread now. I will try and target specific pages with that technique :slight_smile:

Thanks, that’s what I was looking for.