I need to create journal articles that reside under monthly journals. So essentially the user would click on journal 1 and see 5 articles under that journal. If they clicked on journal 2 they would see the articles related to that journal. On the admin point of view we would need to create a journal x and then all the journal x articles. I'm currently using entity reference to link content types. Is there a better way to do this. Are there case studies? Is Views, entity reference, and custom content type the way to go?

Thanks,

Comments

wadmiraal’s picture

Custom content types are always a good idea. Entity reference is a good idea, but does the Journal Month need any information? Or is it ever displayed on its own? If not, I would use Taxonomy.

Create a new Taxonomy vocabulary (like, Journal) and create terms for each month.

Then, in the article type, add a Taxonomy field. This field can reference the Journal month (just like entity reference, but more lightweight).

Finally, because you are using this approach, you can use Drupal built-in taxonomy term pages to list the articles (taxonomy/term/{term-id}; if you use Pathauto, you can turn this in nice, human-readable URLs automatically). Of course, you could also use Views if you need more fine-grained control on how to display things.

Another advantage over using Entity reference, is that you can create Taxonomy Terms on the fly. Say, you are in a new month, and the Journal Month doesn't exist yet. You could simply use the "tags" widget, which allows you to type in the month name (or whatever pattern you use). If it doesn't exist, it will get created. This is much easier than creating each Month entity by hand.

Does this help?

artpop’s picture

That makes a ton of sense. I can't tell you how much I appreciate the response. My concern with using Taxonomy was the on the fly option as I need to give people the control to add new volume #s. It sounds like the tags widget would solve that problem. I'm going to work on this now and let you know how it goes.

artpop’s picture

Ok so I made a vocabulary and called it Journal A. I created Terms called jan,feb,mar, etc. I created a new article type called Journal article with taxonomy as a field. Here I created multiple articles under term jan. So now when I go to lets say article x it has a link to Jan which shows all the articles under Jan. Is there a way to link up to all terms under Journal A at this point? So You would essentially have a link heirarchy of Journal A---->Jan,feb,Mar------->their respective children. That way if someone lands on an article from search they can get back up to the month and the volume levels. Does this make sense?

Thanks

wadmiraal’s picture

Drupal does not provide a page out-of-the-box for vocabulary child terms (meaning, showing everything under Journal A), but you could use Views for this part.

You should be able to create a View, with a path like /journal/{vocabulary_id}. (the following needs double-checking, but I think it's possible) This View would list all Nodes that are linked to a Term that is a child of the passed Vocabulary ID. Are you familiar with Views? It's UI is quite daunting if you're not used to it, but it's very powerful.

wadmiraal’s picture

Oh, wait. I just realized your Journals always have 12 months. So, actually, there's a better way to do this.

You could create a Vocabulary called Journals. Each Journal will be a Term itself. Then, on the Content Type, you could simply add a custom field (select list) that lists all months.

That way, users can add an entry to a Journal (via the tags field), and if the Journal doesn't exist, they could add it that way (or not; you can restrict it if you wish). And they simply select the month from the list (which won't be terms anymore, just hard-coded values).

You could then create a View, with multiple Page displays:

journal/{term_id}: would list all entries for the journal (basically the same as the built-in taxonomy/term/{term_id}
journal/{term_id}/month/{month}: would list all entries for the specified Journal, and the specified month.

This requires a little bit more setup up front, but will probably be much easier to maintain in the long run.

Am I making sense here :-) ?