News archive - General Discussions - General Discussions - Progress Community
 General Discussions

News archive

  • News archive
  • Hi,

    I am new to sitefinity 4. I have a news archive in my page which is displaying the "YearMonthDay" of all the news which was created. Could I show only previous year's/month's only in the list not the recent year/Month???

    In news module I tried to change published date but its coming today's date by default. How an admin user will use this if he wants "DateCreated" / "Published date" to be not today's date???. This is ridiculous.

    Also I cannot find advanced option in news archive widget as even though am an admin user...???

    Pls help me to sort this out??

    Thanks,
    sathya
  • Any solution for this...
  • Hello sathiyaseelan,

    Create a custom field for your news items ( i created date/time field) and add code of your project.
    use this code.
    var newsAll = App.WorkWith()
                    .NewsItems()
                    
                    .ForEach(nI =>
                    
     
                        var val = nI.GetValue("Old").ToString();
                        var ss = DateTime.Parse(val);
                        nI.PublicationDate = ss;
                        nI.DateCreated = ss;
                    )
                    .SaveChanges();

    The value " Old " is the name of the custom field I created to set the old date I wanted to be displayed and also fill in the custom field in the news where you want to change the date.

    Best wishes,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hello Stanislav,

       I have couple questions about the code you provided.  If I create a custom field for "Old,"  will that overwrite the publication date with the code provided?  If so, will that mess up the archiving feature at all?  Also, if I were to execute code like this where do I add it to my project?

    Thank you,

    Steph
  • Hello Stephanie,

    1. It will overwrite the current publication date
    2. The code will not change the publication date in all places where the news item appears like Revision History. If you refer to the Archive widget I think it takes the publication date displayed when you access the news module so the date there will be changed.
    3. To execute the script add a Webform to your SitefinityWebApp project and paste the code in its code behind file in Page_Load method. You will need to add the needed usings to reference the needed Sitefinity assemblies.

    Best wishes,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • hi,

    I am new in sitefinity 6.2 I have news archive in my page I want to display expired news in archive only in between 3 month to 9 month .How I show it

    please  help me as soon as possible

  • Hi Vakeel,

    In order to achieve your need, you need two options:

    1) By dropping the News widget and under Edit menu filter the Items by date/period
     - or -
    2) By creation of your own custom widget, query the news items and group, filter and display them as you need.

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  •  

    Hello Svetoslav

    I am new to sitefinity ( version 7). I have been trying to locate News Archive but didn't find it. I have created couple of news items and added news list on my News Page. Now I am trying to  create news archive ( based on year) . My navigation looks like  this Company->News and I want to show news archive like  company->news->2015.

    Thanks

     

  • Hello,

    For adding archive use the Archive widget on the page and configure it based on this documentation. For DataBuildOptions use "Year" and the years in which the news items were published will appear for filtering the news items using the archive.

    Regards,
    Stanislav Velikov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Thanks Stanislav  .I have couple of more queries

    1) I need to add a search for all listed newsitems ,So I added  Search box and search result box but even after creating search Indexes only on newsitems ,it seems to search the entire site.

    2) I have been trying to create a custom news search box result template which display results same as in newsItems list and copied news list template to search result template but its not working.

    3) How do I set page url for  News Archive link  2015  ,"company->news->2015"? Clicking on 2015 should open up a new page  http://localhost/news/newsArchive but its opening on the same page I have this navigation widget which is  http://localhost/news

     

  • Figured out the third part ,setting up url for News Archive. Still looking answers for first two.
  • We have unpublished news articles as they expire, but I would for them to be listed in an archive listing. I have set up the archive widget where I would like for it to show, but would like the unpublished articles to retain their original date when published showing in the archive listing. As it is now, when we publish them so that they show in the archive, it publishes the article with the current date. Is there a solution for this?