Note: This posting is just about experimentation with queries and is not meant to be user documentation.
The Experiment - Update The "Blogs" page.
The standard template for AFS web sites comes with both an "Events" and "Blogs" page. Our chapter web site still had the default "Blogs" Section with default content from 2015. It was in big need of an update.One of our local host families had just won the AFS Reel Life contest and had been featured on the AFS blog. I wanted to add this post to our chapter blogs page. The event had been posted on the AFS Host Family Blog as well so I was excited about updating our blog to feature it.
Since the posting was already in the AFS content database. I thought, "How hard can it be to just add this post on our page?" Seemed like all I had to do was reference the posting ID on our page or maybe pick up on their feed? Maybe while I'm at it, I can remove these old 2015 posts?
Attempting To Edit the page directly with Click & Type
The AFS web site editor uses a content management system called "Click & Type". All the pages are nicely displayed and finding the "Blogs" page is easy. Within the editor, you can view the page and edit details. Content is edited on the "Content" tab.
I went to the content tab, but sadly, it was blank which mean some "magic" was happening under the hood somewhere. Click & Type uses an HTML editor called CKEditor. Fortunately, CKEditor has a "View Source" option so I checked the source. Sure enough, there was a query being used to pull content into the page.
Playing with Queries
It appeared that our blogs page was created through a back end database query for "r:usa_news". The query passed in our chapter as a parameter.
<r:usa_news category="Chapter: California Central Coast" url="../blog"></r:usa_news>
Since my goal was to both remove the old posts, as well as reference the new existing one, changing the query seemed like a reasonable way to go. I did some playing around and quickly discovered that the Chapter was an important query parameter. For example:
Postings from San Diego:
<r:usa_news category="Chapter: San Diego" url="../blog"></r:usa_news>
Postings from Milwaukee:
<r:usa_news category="Chapter: Milwaukee" url="../blog"></r:usa_news>
Postings from the AFS USA News Blog:
<r:usa_news></r:usa_news>
It seemed like just displaying the host family blog would give me what I wanted. This would give me the new host family post AND get rid of the pesky old posts we had on our page. Also it means AFS would essentially be curating the page for us. I tried several other things.
<r:usa_blog></r:usa_blog>
<r:blog></r:blog>
<r:host_family></r:host_family>
<r:host-family></r:host-family>
Alas, none of them gave fruit. I was stuck. There didn't seem to be a query change that would show the AFS Family blog on the page. I took a look at the query for the Events page. It had a similar format so I played with this for a while as well.
<r:events category="Chapter: California Central Coast" type="upcoming" url="../events"></r:events>
The query change didn't seem to be working out. However, I had a new idea. If I was able to tolerate the old posts still being there, what if I created my own new "Chapter: California Central Coast" posting? This would display the new posting at the top of the old ones.
I'd need to screen grab the image from the AFS web site and I'd also need to copy/paste the text. Though, I was pretty sure a new posting I created would at least display on the page. Now, that does not clear away the older default postings, but at least I'd get the article up there.
<r:events category="Chapter: California Central Coast" type="upcoming" url="../events"></r:events>
The query change didn't seem to be working out. However, I had a new idea. If I was able to tolerate the old posts still being there, what if I created my own new "Chapter: California Central Coast" posting? This would display the new posting at the top of the old ones.
I'd need to screen grab the image from the AFS web site and I'd also need to copy/paste the text. Though, I was pretty sure a new posting I created would at least display on the page. Now, that does not clear away the older default postings, but at least I'd get the article up there.
The Answer: Re-create the posting.
Since I wasn't likely to figure the incantation to just show the Family Blog page, I changed course and decided to just re-create the original AFS posting within our chapter web site. This is done under the "News" tab in "Click & Type. I copy/pasted the text from the original AFS posting and screen-captured the image. I then added the image to the posting (using the "Image" tab) and posted a new "News" article. Here is what the new posting looked like in "Click & Type".
Once the article was saved, it showed up on the blogs page. I still have the older 2015 postings along side it, but at least I was able to show the new article.
Now, this does mean that we have two essentially identical postings in the AFS content database, but I can see why each chapter having their own content makes a lot of sense. Here's both postings so you can see the difference.
Original article : https://www.afsusa.org/host-family/blog/article/?article_id=10146
New posting for our chapter site: https://www.afsusa.org/team/ccc/blog/article/?article_id=10152
The local chapter article displays properly and looks good. I'm happy with the result and learned a lot along the way.