Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
EllyCobbett

I'd like to apply different colours to my links in blog post summaries depending on what category the post is in.

Question

Site URL: https://rosalindbrookman.com/blog

I'd like to apply different colours to my links in blog post summaries depending on what category the post is in. So for example if a post has the category of 'Business' then the blog post title and read more link would be green on the summary, if the category is 'Writing' then it's red etc.

Many thanks for any help you can offer.

Share this post


Link to post

9 answers to this question

Recommended Posts

  • 0

If you add this text to blog link, you can use code easier.

eg this post https://rosalindbrookman.com/blog/seeing-daniel-wakeford-live-is-a-joyous-experience

edit link to

Quote

or

Quote

then add this to Home > Design > Custom CSS to change all post title has "writing" text in link

.blog-title [href*="writing"] {
    color: red;
}
a.blog-more-link[href*="writing"] {
    color: red;
}

 


You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Armadillo - Free portfolio template

Share this post


Link to post
  • 0
1 hour ago, tuanphan said:

If you add this text to blog link, you can use code easier.

eg this post https://rosalindbrookman.com/blog/seeing-daniel-wakeford-live-is-a-joyous-experience

edit link to

or

then add this to Home > Design > Custom CSS to change all post title has "writing" text in link


.blog-title [href*="writing"] {
    color: red;
}
a.blog-more-link[href*="writing"] {
    color: red;
}

 

Can I change the url slug to include the category on all post using the Post URL Format setting somehow? Or do I have to go through every individual blog post?

Share this post


Link to post
  • 0
Just now, ryandejaegher said:

@EllyCobbett Are you referring to automatically adding the current category based on the URL?

I.e. if someone is on the "writing" post, the category URL and text will automatically be added?

I think so. Based on tuanphan's answer I need to get the category assigned to each blog post in the url. I'm not the person writing the blog and I know it will probably get forgotten when I hand over to my client if it's not automated somehow. The Post URL Format setting seems the most likely place to make this happen, but it doesn't appear to be an option.

Share this post


Link to post
  • 0

@EllyCobbett, you can style the category text based on the href with CSS but that won't handle dynamically adding the category. 

To make sure I understand correctly, you manually added the category link at the top of the post right?image.thumb.png.8e009b060fcf162efe01ae74a071f814.png
 


Philadelphia, PA

Available for hire

Beyond Copy/Paste: Learn CSS for Squarespace Workshop

Chat/Message on FB Messenger for quickest responsehttps://m.me/dejaegherryan

 

Share this post


Link to post
  • 0
1 minute ago, ryandejaegher said:

@EllyCobbett, you can style the category text based on the href with CSS but that won't handle dynamically adding the category. 

To make sure I understand correctly, you manually added the category link at the top of the post right?image.thumb.png.8e009b060fcf162efe01ae74a071f814.png
 

The categories have been assigned to each post already. What I'm looking for is a way to make this:

48881670_Screenshot2020-06-14at15_38_25.thumb.png.50a11680d1d78ee82e5fd7ed352d4e3e.png

 

Look more like this in terms of the title and read more colours:

 

1896053824_Screenshot2020-06-14at15_40_43.thumb.png.6cb080f60ceb314b4737f8f85ae0bd70.png

 

I thought I might be able to do that based on the different categories already assigned to the posts, but I'm struggling to find a way. Any suggestions gratefully appreciated.

Share this post


Link to post
  • 0

@EllyCobbett I see, you're able to display the meta for the blog posts correct? 

What I would do is to make this visible, then what you can do is add some code that will target the blog posts based on the category, if they match a specific category then you can apply a class that will style the content of the post. 


Philadelphia, PA

Available for hire

Beyond Copy/Paste: Learn CSS for Squarespace Workshop

Chat/Message on FB Messenger for quickest responsehttps://m.me/dejaegherryan

 

Share this post


Link to post
  • 0
4 minutes ago, ryandejaegher said:

@EllyCobbett I see, you're able to display the meta for the blog posts correct? 

What I would do is to make this visible, then what you can do is add some code that will target the blog posts based on the category, if they match a specific category then you can apply a class that will style the content of the post. 

Ok, so if I swap Author out for Category in the displayed meta data, then I should be able to do it with css? (I only have two available slots to display meta content and I have to keep the date).

Share this post


Link to post
  • 0

@EllyCobbett you'll still need some custom code/JavaScript to target elements other than the category text. You won't necessarily have to show the category, you can hide it with CSS but the JavaScript will still be able to target it (even though it's hidden)


Philadelphia, PA

Available for hire

Beyond Copy/Paste: Learn CSS for Squarespace Workshop

Chat/Message on FB Messenger for quickest responsehttps://m.me/dejaegherryan

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...