mercredi 17 novembre 2021

Rails 6 Creating IF statement for conditional meta_tag based on DB value

I have looked at multiple pages, but my brain cannot bridge the gap to how this problem should look answered.

Problem: I need very specific DB generated show pages to have <meta name="robots" content="noindex">. I know this will require an IF statement somewhere. So it boils down to I need specific DB driven pages in my people index to not be indexed by search engines as their pages are really not supposed to exist. (If a @person.position = "hide" they need to not exist to a search engine)

Setup: My app is setup with a layout/application page that contains all html, header, footer, meta data, and a yield call for all of the data for each page shown in the browser.

I am not sure where the if statement will go. Will I need to add a call to the controller? The more I look at this it seems like a super sloppy approach.

Aucun commentaire:

Enregistrer un commentaire