Site logo

[Resolved] Bit confused on how I should approach the blog page?

Home Forums Support [Resolved] Bit confused on how I should approach the blog page?

Home Forums Support Bit confused on how I should approach the blog page?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2415491
    Andrew

    I have a site that now wants to add a blog but I’m not sure how best to approach it with Generatepress. At the moment, as there is no blog, there is no blog page set in WordPress – Settings – Reading.

    Should I create a page and set it there? Or should I create a page, not set it there, and use query loops?

    Can I edit the standard Blog page (set on WordPress) using Generatepress via Elements? I assume that is the best route but I can’t see any relevant guide in the Docs to follow? If you could point me in the right direction that would be greatly appreciated, thanks!

    #2415589
    Leo
    Staff
    Customer Support

    Hi Andrew,

    I would say creating a page and assigning it to the Posts page in the Readings setting is the first step.

    As for editing the blog page, it depends on what you are trying to edit.

    There are some customizer options:
    https://docs.generatepress.com/article/blog-content-layout/

    Or you can also create various templates:
    https://docs.generatepress.com/article/block-element-content-template/
    https://docs.generatepress.com/article/block-element-post-meta-template/

    Hope this helps to get you started.

    Let me know 🙂

    #2416081
    Andrew

    Thanks! I think I am getting there.

    One thing I’m not sure is how to add a title to the blog page? If I add it to the Content Template Block Element then it adds it at the top of every post. If I add it to the blog page it gets ignored? I must be missing something!

    On a semi-related note, on pages I add a container and then the margins sort out the layout but I can’t seem to do this with the blog page – Do I need to do it a different way?

    And lastly! Ideally I’d like every blog post to be in url/blog/post-url instead of on the main domain but I’m not sure what to change! (I appreciate this may not be Generatepress related so feel free to ignore!)

    I’ve added a link to the example blog post for info. Thanks.

    #2416302
    David
    Staff
    Customer Support

    Hi there,

    Just to cover:

    In the Theme we have several templates, Blogs and archives use the archive.php template.
    Within those templates is the WordPress Loop function that finds all the relevant posts related to the current query.
    And for each one it outputs the individual post using the themes content.php template.

    When you create:

    a. Block Element – Content Template, it overwrites the content.php template
    b. Block Element – Loop Template, it overwrites the entire Loop template.

    So considering your first 2 questions it may make more sense to use a Loop template.
    Then you can add:

    1. Your Title and other content.
    2. A GB Query Loop Block. You should set the Inherit Query from Template option

    You can then also use the GB block settings to control your margins etc.

    Note:
    I would suggest you create one Loop Template specifically for the Blog ( Display Rules Location ) if you want to customize the title and any other text.
    Then a separate Loop template for All Category Archives, where you can use the GB Dynamic Data to display the Heading etc.

    Regarding the permalink structure – are you using an SEO plugin? As those are best suited to create a custom structure.

    #2416354
    Andrew

    Thanks, I’ve used the Loop Template for the Blog but I’ve hit a wall when trying to create one for All Categories Archives. I can’t see what I have to do differently compared to creating the first Loop Template for the Blog?

    I use the SEOPress plugin but I don’t think that has anything in it for permalink structure. I think I’ve sorted that though, I changed the structure to /blog/%postname%/ and it only seems to have affected posts which is what i was after – Pages have kept their existing URLs which is a relief!

    #2416768
    David
    Staff
    Customer Support

    The second template will be identical to the one for the Blog, except you can:

    1. select the Headline Block you have for your title, and in the Blocks Toolbar, select the Dyanmic ( disk icon ) options, and set the Dynamic Text Type to Title. This will automatically show the relevant category term for the title.
    You can add some Before text too.

    2. Optional – you can add below the title a GP Dynamic Data block and set its Type to: Term Description. This will pull in the terms description if one is set.

    3. The Query Loop block MUST be set to Inherit Query from Template

    4. The Display Rules will be Post Category Archives.

    #2416883
    Andrew

    Excellent, thanks! All makes sense. Loop Templates are excellent!

    I just have one last query… In the Block I’m putting them all in a container in the same way I do with pages. And I add the margin in the same way I do with the pages but the alignment is different on these pages compared to the normal pages. I’ve added an example below – Do you have any idea why that is?

    If you see the example page the left sidebar is where it should be but on the blog page it’s down and to the right?

    #2416893
    David
    Staff
    Customer Support

    So on your Pages you have the Content Container set to Contained – which removes the Themes padding.
    To do that on Archives and the Blog you would need to add a Layout Element, and use that to set the Content to Contained

    #2416982
    Andrew

    Excellent, thanks again!

    #2417848
    David
    Staff
    Customer Support

    Glad to be of help!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.