{{ template:body }} adding the page title - pyrocms

Not sure if this a PyroCMS 2.2.3 bug, but everytime I use {{ template:body }} on my default.html seems that it always add this <h2>Page Title Here</h2>. I already checked on the admin via "Content > Pages > Page types > Edit > Page Content" and I don't see any tags that I placed in there. How can I get rid of it?

This is not a bug. This is how it works. From v2.2 they have changed the page layouts and it works like this.
Your template files control the main layout of the page (default.php, etc)
Then at the Pages, you can make use of "page types", each page type can use any of your template files to replace it's contents with {{ template:body }}
Now, you can write down your page layout via admin panel Pages -> Page types-> Edit -> Layout tab which as default there is a h2 tag for title there.
<h2>{{ page:title }}</h2>
{{ body }}
This gives you the flexibility to use any kind of custom field for any of your page types.
So, simply edit the layout of the page type you are using and manage how you want to arrange contents via your *page layout*s.
I hope I could make it clear for you :)

Related

Jekyll Collection of _posts Not Rendering on _site

can someone help me?
I have a Jekyll site on netlify (http://127.0.0.1:4000/) that is working great.
I followed this tutorial to create a Jekyll admin path with CMS (http://127.0.0.1:4000/admin) to administrate the posts I want to write.
Basically, I created a new admin folder with two files, index.html and config.yml. My new file config.yml is like so...
It is working properly, I can create and update the posts on the _posts folder as expected.
Wherever, I'm trying to create a blog on a subpath of that site, like http://127.0.0.1:4000/blog for loop through the posts on _posts on such path, but I doing something wrong and can't figure out what is it.
The last thing I tried was to create a collection for the posts on the main file _config.yml like so...
I tried two permalinks, add/remove the folder and add layout, but I think I'm forgetting something.
To help you guys understand the whole project, my index.html has
---
layout: default
---
and the layout default is on the folder _layouts and contains many imports that are on the folder _includes.
Finally, I tied to loop through the collection of _posts on index.html adding code like bellow on the file posts_list.html that was imported as you can see above...
<h1>Latest Posts</h1>
<ul>
{% for p in site.posts %}
<li>
{{ p.title }}
<!-- {{ p.excerpt }} -->
</li>
{% endfor %}
</ul>
and also creating a new html file called posts.html on the same folder of index.html with the same code above, but in both cases the posts are not rendering.
Finally, this is my whole project...
If you want more info about what I'm doing, just ask,
Thanks for helping me...
[UPDATE 1]
My posts are .md files, here is an example...
As you can see I also created some extra layouts, one for compiling all posts blog and another for show the post itself post.
Change the extension to .md (on your posts and index file) and add frontmatter, referencing your template. Your posts.md and index.md files should look like this:
---
layout: default
---
Check for errors... if there are none it should output just fine.
UPDATE
Thank you for sharing your code at https://github.com/nielsenrechia/nr.github.io.
I see that you created random comments in your config file. They mess things up. Clean up your config file and use the right indents and new lines. Check out the Jekyll documentation at https://jekyllrb.com/ for help. Further you seem to reference your posts by calling site._posts. That should be site.posts. Finally, you do not need to specify the posts collection in the config file. It is assumed that it exists and uses the _posts folder.
Here is an image of the working posts section:

How to Hide Header in Homepage in Laravel

I am trying to customise a laravel site. I want a different header layout for the homepage. Please how do I do that.
What I currently have is a master layout which include the header layout. What I need is something like this in this website www.jiji.ng as you can see, the homepage header layout is different from the rest of layout. I need a general header for the site but different header for the homepage.
Below is the Master.blade.php code
#section('header')
#include('layouts.inc.header')
#show
#section('search')
#show
There's a variety of ways of doing this.
You could check the current route name. Give your home page route a name, then do:
#if(Route::currentRouteName() === 'home')
#include('layouts.inc.header')
#endif
You could also have multiple layouts for your app, via the #extends keyword.
Your home page route might do:
#extends('layouts.home')
and the rest of the app would do:
#extends('layouts.app')
You can use #component and you can pass any view into it like this:
#component('header')
#include('your_header')
#endcomponent

using ZURB Foundation with laravel

I am new to laravel so I am not sure how this can be achieved. I am using ZURB Foundation and trying to create a button in the page.
I use linkRoute always to redirect to a named route then redirect to a specific controller action. I have the below:
<body >
<h1 align="center">ShopCon.com</h1><br><br>
<a style="margin-left:50px;" href="{{ HTML::linkRoute('membersaccess', 'Members Access') }}" class="medium success button">Login or Register</a>
</body>
but when I render this, it shows like this
Members Access" class="medium success button">Login or Register
instead of showing the button and text within it and link to named route. How can this be fixed? I read something about macros but unable to clearly understand them or use them to achieve this.
Picture included for reference:
HTML::linkRoute produces an HTML anchor tag.
Since you only want the URL, use URL::route.

Accessing PyroCMS Module inside Custom Theme

I have designed a custom theme and I need to be able to load a module I have made into my default.html page. I have written the following so far:
<div id="outer-content">
<div id="content">
{{ template:body }}
</div>
</div>
What do I replace {{ template:body }} with in order to display a custom module?
Maybe this will help.
In your theme, save your default.html file with the same name as your module. For example, you can create a custom layout file for the blog and save it as blog.html. When the module gets called it uses the layout file with the same name as your module.
If thats not an answer for you try posting on the PyroCMS Modules forum.

How to add share buttons in magento CMS pages?

I have created CMS pages in Magento and I want to share with Social site using share buttons Facebook, Twitter, Google+ so any one to tell me how to do that ?
Add this part to :
your_package/your_theme/template/page/html/head.phtml
before this line --> <?php echo $this->helper('core/js')->getTranslatorScript() ?>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-c297c92f-9661-1cf3-697d-47c19ab7e281"});</script>
Add this part to your cms page :
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>
NOTE: using sharethis extension
You can check below URL for Addthis button, select style of button you want to share, grab the code and add that code to Magento Admin >> CMS >> Pages. click on to Html view of Editor and paste the code which you have grab from Addthis site, and you will see share buttons on front end. Another method is you can add this code to your template file commonly used for Example 1column.phtml is used for CMS pages and you need Share buttons on all CMS pages then you can paste the same code in .phtml template file.
Add this : https://www.addthis.com/get/sharing#.UK8_PoafHcc
Although this is an old thread i would like to share my answer which i found.
Add a meta tag in
template/page/html/head.phtml
<meta property="og:site_name" content="yoursite.com"/>
Create a Custom Variable from System/Custom Variables by pasting the Facebook sharing button code to Variable HTML Value.
To add like/share button to cms or static block, use the “Insert Variable” button to insert the Custom Variable you have just created.

Resources