Forum

Thread tagged as: Blog

Blog related questions

I'm new to Perch so I have some basic (probably... hopefully) questions regarding the blog app:

Q1 I'll start with the most important question: My site will have a few simple pages (like home, contact, etc.) and also two separate blogs, so I'm wondering what would be advisable structure-wise. Also, how do I create more than one blog :)

Q2 I'm currently still experimenting with the template files that come with the blog.zip, the "outer shell" of the blog pages are the same as the rest of the pages. So I was trying to setup the same regions in the blog/index.php as for example in root/index.php like this.

<?php perch_content('header'); ?>

But that doesn't seem to work, is this somehow possible?

Q3 Is there a way to include the blog in the 'default' navigation, I'm using this code right now which I probably found somewhere in the documentation and works fine for the pages in the root folder, but the blog doesn't show up.

<?php perch_pages_navigation(); ?>
Sjoerd ter Haar

Sjoerd ter Haar 0 points

  • 4 years ago
Simon Clay

Simon Clay 127 points

Hi,

for Q1 check out Blog Sections: https://docs.grabaperch.com/functions/blog/perch-blog-sections/

Q2: Adding <?php perch_content('header'); ?> to blog/index.php should work. Add it in and load the page in the browser, then back in admin you should see Blog listed in pages.

Q3: Successfully completing Q2 (which adds Blog to the Pages list) should then make Blog show in the default navigation. Items only appear in perch_pages_navigation(); if they are in the Pages list.

Simon Clay said:

Q2: Adding <?php perch_content('header'); ?> to blog/index.php should work. Add it in and load the page in the browser, then back in admin you should see Blog listed in pages.

Q3: Successfully completing Q2 (which adds Blog to the Pages list) should then make Blog show in the default navigation. Items only appear in perch_pages_navigation(); if they are in the Pages list.

Weird, I'm pretty sure I tried it like that about 20 times before, but I guess not, because now indeed the header is included and the blog is part of the navigation, thanks!

Regarding multiple blogs, I've been digging around on the forum and stumbled upon a post on the Perch news blog introducing multiple blogs:

The ability to create multiple, distinct blogs had been requested by some of you with larger sites. We’ve added this functionality for Perch Runway sites. You can now create multiple Blogs with one installation of the App.

At the moment I'm not using Perch Runway though and since I'm new to Perch it's hard for me to discern from everything I've read if Runway will make building the site more complicated. Or if everything will remain the same just with added features.

Simon Clay

Simon Clay 127 points

Runway is a little more technical, and moving forward Rachel and Drew plan to make Perch simpler and Runway more advanced for developers.

However I am running 2 types of blog on a standard Perch site using Sections, as seen here: https://www.kbstudios.co.uk/news-blog/

Hmmmmmmmmm, not exactly what I hoped for. Your blog works nicely, but I really need two separate blogs and I'm already struggling with regular Perch atm. Well, not really struggling, but this is just for a personal, non-commercial site I'm building in my off-hours, so I don't have too much time to devote to this project and I'm afraid switching to Runway means it will take me months rather than weeks to build this site.

Simon Clay

Simon Clay 127 points

I understand. You can use the 'Sections' in different parts of the site.

Alternatively you can download my copy of the Perch News app here: https://www.sly-design.co.uk/perch-cms/ to enable you to have two separate apps, Blog and News. I hope that helps.

Thanks a lot for you help! I'll look into this.

BTW, there's a small typo in your Perch News App section :) : "..many 'scetions' in your..."

Simon Clay

Simon Clay 127 points

Hey, thanks very much :)

Ok the news app seems exactly what I wanted, just an extra blog which is great.

But now I'm encountering some other challenges, I don't want every blog post to have the same layout content-wise.

So for example:

blog post A

///////////////////////

Title

text-block | image

text-block

quote

image

///////////////////////

blog post B

///////////////////////

Title

text-block

quote

image

quote

image | text-block

///////////////////////

I think I saw something like this in the documentation or a tutorial video for normal content, repeatable blocks for which you can choose what type of layout it should be. But I've seen so much Perch stuff today that I'm not sure it's really a thing and I can't find it anymore. And if it's possible for normal content, does that mean it's also possible for blog posts?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you're describing post types: https://docs.grabaperch.com/addons/blog/post-types/

Drew McLellan said:

I think you're describing post types: https://docs.grabaperch.com/addons/blog/post-types/

I think this is indeed what I saw in a video before, but turns out this is not what I want exactly.

What'd like to do, not only for blog posts but for every page, is add regions through the CMS. So you'd define one or multiple 'spaces' within a page which can contain regions and in the back-end you'd go to "page / add blog post -> edit 'space' -> add region -> pick a template". So basically, I'm looking for an extra level above region, but I can't find anything like this within the documentation.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not the approach Perch takes.

Man, that's such a bummer, there's a lot to like about Perch but this lack in flexibility in laying out pages is a real deal breaker for me unfortunately :(

Drew McLellan

Drew McLellan 2638 points
Perch Support

Perch isn't intended to be a point and click website in a box solution. It's aimed at professional web designers who will work with clients to design masters for the types of pages they need to publish. It is not desirable in that context for a user to be able to, for example, throw a bunch of blog posts onto a Contact page.

It sounds like something more like Squarespace might fit your needs.

Squarespace... it's a good thing I have a thick skin ;-)

I think you might be misunderstanding me (or vice versa), because that "blog post on the contact page" example is not what I mean.

Say I've made some shiny 'content' templates: 1) text block 2) a quote etc.

Now I'm writing a blog post starting with a text block, next I want a quote, as I understand it in Perch you'd have to pre-define where you'd want that quote. What if I need two or three quotes in a different article? What if I want to start with a quote then resume with a text block?

I've been using Jekyll, which offers endless layout flexibility, but is of course an entirely different beast with it's own pros and cons. But it probably still suits me better.

Simon Clay

Simon Clay 127 points

You can use Blocks and Repeaters to have any amount of content types in any order. It really is super flexible:

https://docs.grabaperch.com/templates/blocks/

https://docs.grabaperch.com/templates/repeaters/

Drew McLellan

Drew McLellan 2638 points
Perch Support

Simon is right - you'd use Blocks within a region. But there's no level above a region.

You sound critical of Squarespace - that's not what I mean, it's a different tool with a different purpose. It enables you to build a site in a browser, not in code.

Ok that's great, so there was a misunderstanding.

Blocks within a region sounds logical though, it's that extra level I was looking for thanks again Simon, you're pointing me in all the right directions.

I've watched the blocks video and that seems like something I can work with: https://docs.grabaperch.com/video/v/introduction-to-blocks/

One thing that wasn't in the video is if you can reorder the blocks after you've inserted them, but that's not that big a deal.

Guess I'll have to send a follow up mail to support that I don't need that refund (yet).

I'm critical of Squarespace, because from what I've seen of it, it's not very flexibel, at least not in the way I'd like it to be and in Firefox (I think) the site I was dealing with downloaded some 3MB unidentifiable thing. Also as a front-end coder I must have control over the HTML and CSS :-) I'm not saying Squareplace doesn't have a place, but it's not for me.

Simon Clay

Simon Clay 127 points

That's great, yes you can reorder Blocks at any time.

I'm happy to say I've made good progress this evening, where before this evening there was nothing now there is a block infested blogpost option:

<h1>
    <perch:blog id="postTitle" type="text" label="Blog Title" required="true" size="xl autowidth" order="1" />
</h1>
<perch:if exists="blogPostSubtitle">
<span class="subheading h3">
    <perch:blog id="blogPostSubtitle" type="text" label="Blog Subtitle" size="xl autowidth" order="2" />
</span>
</perch:if>

<perch:blocks>

    <perch:block label="Plain text with dropcap" type="b_plainTextDropcap">
        <div class="drop-cap">
            <perch:blog id="c_plainTextDropcap" label="Plain text with dropcap" type="textarea" editor="tinymce" html="true" />
        </div>
    </perch:block>

    <perch:block label="Plain text" type="b_plainText">
        <perch:blog id="c_plainText" label="Plain text" type="textarea" editor="tinymce" html="true" />
    </perch:block>

    <perch:block label="Blockquote" type="b_blockquote">
        <perch:template path="blog/blocks/blockquote.html" />
    </perch:block>

    <perch:block label="Media - text | image" type="b_mediaTextImage">
        <div class="o-media">
            <div class="o-media__body col-1of2">
                <perch:blog id="c_mediaTextLeft" label="Media text left" type="textarea" size="l" editor="tinymce" html="true" />
            </div>
            <div class="o-media__img col-1of2">
                <img src="<perch:blog type="image" id="c_mediaImageRight" label="Media image right" />" alt="<perch:blog id="c_mediaImageRightAlt" label="Image alt" type="text" />">
            </div>
        </div>
    </perch:block>

    <perch:block label="Media - image | text" type="b_mediaImageText">
        <div class="o-media o-media--rev">
            <div class="o-media__body col-1of2">
                <perch:blog id="c_mediaTextRight" label="Media text right" type="textarea" size="l" editor="tinymce" html="true" />
            </div>
            <div class="o-media__img col-1of2">
                <img src="<perch:blog type="image" id="c_mediaImageLeft" label="Media image left" />" alt="<perch:blog id="c_mediaImageLeftAlt" label="Image alt" type="text" />">
            </div>
        </div>
    </perch:block>

</perch:blocks>

Far from done yet, but now I'm really working towards something instead of floating aimlessly :) I can already build a pretty decent blog post.

I just discovered you can create mini templates for these blocks which I tried with the blockquote and works nicely. This could be handy because I'm using the two blogs, although I'm not sure if and how I can make the ":blog" ":content" ":news" part of the markup a variable since the template is of course HTML. That would be really nice, because than I could use these blocks everywhere without copying the same file 2 or 3 times and only changing one word.

Simon Clay

Simon Clay 127 points

Hey, sounds good :)