473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Automatically Display Most Current Post in Blogger (Mobile)

Frinavale
9,735 Expert Mod 8TB
Hi,

I have started a blog for a local group that I volunteer with so that we can communicate with the public, post information about ourselves, and provide a means for the public to get in touch with us. We are using Blogger since it is a free blogging service offered by Google and it is relatively easy to use so that members can maintain the site going forward. Currently the website is using the "Travel" theme that has been modified using CSS to look the way we want it to. (www.wildwindflutechoir.com)

At the request of the organizer for the group, I have modified the "Blog Posts Gadget" so that it only shows 1 post and have removed any widgets that displayed "popular posts" or "past posts". This way only the most recent information/article is displayed on the home page... and the other pages in the site (like the about-us page) don't have old posts lingering around. The main goal was to no longer display information posted about our Christmas activities on our homepage (or elsewhere in the website) now that Christmas is done...unless, of course, you browse to it through the archive links.

This works fine on desktop browsers; however, when I am viewing the website with a mobile device (or by adding the /?m=1 parameter to the URL)...the home page lists all of the posts.

I cannot figure out how to have it automatically display the most recent post instead of this list.

Please provide some advise on how to modify the Home page of my Blogger blog so that it only displays 1 post in mobile view (and preferably the whole post instead of a preview of it)


Thank you

-Frinny
Mar 1 '18 #1
1 3098
Frinavale
9,735 Expert Mod 8TB
So, apparently my problem a known bug in the mobile templates.

Apparently, if the post count is set to less than 5 posts, then the mobile homepage will always show minimum 5 posts.

So, to get around this bug I had to edit the site's template and hard code the number of posts shown to 1.

I also, in the case that it is the index page (home page), modified it so that the full post was displayed instead of the mobile index.

I considered displaying both the link to the post along with the full details about the post because I discovered that you cannot navigate to older posts in the mobile version on the home page (you have to be viewing a post for it to detect that there is older content).

After customizing the navigation, and failing to get it to work like the desktop version, I decided to just live without it for the mobile for the time being. At least it is closer to what was requested: show only the most recent content.

The only problem is that now you can't navigate to past posts when viewing the website through a mobile device.

The following code is the modified site template that will show both the link to the most recent post along with the full content of the post:
Expand|Select|Wrap|Line Numbers
  1.  <!-- posts -->
  2. <div class='blog-posts hfeed'>
  3.  
  4.   <b:include data='top' name='status-message'/>
  5.  
  6.   <b:if cond='data:blog.pageType == &quot;index&quot;'>
  7.     <b:loop values='data:posts  limit 1' var='post'>
  8.       <b:include data='post' name='mobile-index-post'/>
  9.       <b:include data='post' name='mobile-post'/>
  10.     </b:loop>
  11.   <b:else/>
  12.     <b:loop values='data:posts' var='post'>
  13.       <b:include data='post' name='mobile-post'/>
  14.     </b:loop>
  15.   </b:if>
  16. </div>
Notice the <b:loop values='data:posts limit 1' var='post'> line...this is the hard coded value to limit the number of posts to 1.


This is what I currently have so that only the full content is displayed for the most current post :
Expand|Select|Wrap|Line Numbers
  1.  <!-- posts -->
  2. <div class='blog-posts hfeed'>
  3.  
  4.   <b:include data='top' name='status-message'/>
  5.  
  6.   <b:if cond='data:blog.pageType == &quot;index&quot;'>
  7.     <b:loop values='data:posts  limit 1' var='post'>
  8.       <b:include data='post' name='mobile-post'/>
  9.     </b:loop>
  10.   <b:else/>
  11.     <b:loop values='data:posts' var='post'>
  12.       <b:include data='post' name='mobile-post'/>
  13.     </b:loop>
  14.   </b:if>
  15. </div>
If anyone has any suggestions about how to get the mobile navigation (mobile-nextprev) to work like the desktop navigation (nextprev) I would love to hear it!

Thanks,

-Frinny
Mar 6 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dave | last post by:
Hi, Can anyone tell me a simple way of inserting some sort of code into a Dreamweaver template (it goes at the bottom of the page in Copyright info) that will cause the current year to be...
3
by: Kevin Gibbons | last post by:
Hello all, I've browsed through past usenet archives, but can't seem to come across quite the javascript I'm looking for. I'm looking for a simple javascript that will display the date as such:...
4
by: Bill Burke | last post by:
I'm very new to Visual C# .NET and would appreciate any help. I am using Visual Studio .NET 2003. I want to display the current date from the user system in a web form. I have spent hours...
7
by: Shailja | last post by:
Hi, How to display current date in toolbar of Visual Basic? Kindly let me know if u know.
3
by: Shailja | last post by:
Hi, I am using vb. I want to display current date in MDI toolbar. What code do i need to write and which control do i need to put on the MDI form? Kindly let me know. I am stucked with this...
0
by: remya1000 | last post by:
I need to display current month,last 3months,6months and 1year records seperatly. and first i'm tring to display current month's records. and the error i received is this. Microsoft VBScript...
1
by: DEklof | last post by:
I am new to javascript and need to automatically display a pdf file when an html page opens. How do I do this with javascript? Thanks Dennis
1
by: Claudia Fong | last post by:
Hi, I downloaded the mobile 6 SDK and I'm trying to display my webpages in the mobile 6 emulator, but I'm not able to get into the internet.. the active sync is connected.. When I was using...
2
by: abitex23 | last post by:
How to add 2 numbers together in textbox and automatically display the answer inside the 3rd texbox without click on any button
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.