Header Plugin for Embedded Blog

Creating and modifying plugins.
Post Reply
NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Header Plugin for Embedded Blog

Post by NeilW »

Being new to blogging I am still trying to get my head around how Serendipity works.

But so far I have managed to get my blog up and running and also embedded the Clean Blog template into it.

For the embedded method I followed the instructions for the 'indexFile' option.

But where I appear to be locked in, is that I seem to have no flexibility for the content in my html <head> code.

I would like to be able to the change code there for my 'description' and 'keyword' tags to match the blog content and also for the 'twitter' meta tags for Twitter and 'og' meta tags for Facebook, LinkedIn and Google+. I change these tags on each of my web pages to make them more SEO relevant and relevant when someone wants to Tweet my page, etc.

This obviously needs to be done at page level for each separate post.

I have looked at and tested both the 'HTML META-Tags' and 'HTML-Code inside head (HTML-Head Nugget)' plugins with the 'HTML-Code inside head (HTML-Head Nugget)' seeming to only cater for the top level of the blog and the 'HTML META-Tags' plugin at least giving the ability to add things at page level, but neither of these two plugins seem to work with an Embedded blog anyway.

The 'HTML META-Tags' plugin also seems to be limited with what you can add anyway.

With the 'indexFile' option of embedding, you get only one 'wrapper.php' that directs the browser to include the Serendipity index.php file and only one 'content.php' template file.

This is all done at the top level not at page level. It would be nice if I could create a separate 'wrapper.php' and 'content.php' for each separate post, so that I can then edit each 'content.php' page to be applicable to the content of the post.

Am I overlooking a plug-in that is already available that does this or is there another work-around for it that I cannot see at the moment?

Surely all existing Serendipity users who, in particular, want to post a link with relevant content to Facebook or Twitter have a way to do this as it seems that I can post a comment to Twitter or my Facebook page with an image and title relevant to the blog page from most other blog pages that I read?

Thank you.

- Neil
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Header Plugin for Embedded Blog

Post by yellowled »

NeilW wrote:I would like to be able to the change code there for my 'description' and 'keyword' tags to match the blog content and also for the 'twitter' meta tags for Twitter and 'og' meta tags for Facebook, LinkedIn and Google+.
* description/keyword: plugin HTML META-Tags (serendipity_event_metadesc)
* twitter: I'm not sure we have a plugin for that. Microblogging (serendipity_event_twitter) should be the one for that, but unfortunately, the maintainer is M.I.A., and I'm not sure if that's implemented there. (I don't really care about that kind of stuff and I use IFTTT to announce my blog posts on Twitter.)
* OpenGraph: There's the Facebook (serendipity_event_facebook) plugin which is marked as experimental, but should do the trick. It does more than just OpenGraph.
NeilW wrote:but neither of these two plugins seem to work with an Embedded blog anyway.
That might very well be true for the plugins mentioned above, unfortunately. Not sure.
NeilW wrote:Surely all existing Serendipity users who, in particular, want to post a link with relevant content to Facebook or Twitter have a way to do this as it seems that I can post a comment to Twitter or my Facebook page with an image and title relevant to the blog page from most other blog pages that I read?
Most of us just don't care about the whole SE0 thing that much, though. :mrgreen:

Plus, the embedded usage could really be a stumbling block here.

YL
NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Re: Header Plugin for Embedded Blog

Post by NeilW »

Thanks again YL, I will give those other plugins a try, but like you the more I think about it I tend to feel that trying to edit the "content.php" template on the fly for each blog post for an embedded installation may be an issue at this time.

If Serendipity "replicates" the "content.php" template for each blog post I can see that an edit for each post would work, but if it just "refers to" the template for every blog post it would seem to be self defeating.

Unfortunately, I don't know enough about the workings of Serendipity to know exactly how it works which is why I am hoping for more guidance from this board.

If the plugins that you mention above do not work with an embedded installation, I have thought of a possible fallback with the theme that I am using where it provides a field in each blog post to enter the code to select a hero image.

It may take some work but I could possibly create a separate header file outside of Serendipity (which you have to do or edit on any web page anyway) and then call that file in through php.

Then with a bit of mucking around with the theme code I may be able to achieve what I need.

Which does seem to indicate to me that to get the most out of Serendipity you virtually have to get yourself proficient to write your own themes.

- Neil
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Header Plugin for Embedded Blog

Post by yellowled »

NeilW wrote:Which does seem to indicate to me that to get the most out of Serendipity you virtually have to get yourself proficient to write your own themes.
Well, yes and no.

It does of course help to be able to do that, but it is definitely not a requirement. We're always here to offer support on that anyway, so you can “get by” by just asking how to do certain things in the forums if you want to customize a theme. I guess that's what most people do. Some themes make it easier to customize things through theme options than others.

Then again, it all depends on what you want to customize. Some people are happy with just adding an individual header image or adapting a few colors. That's pretty easy in s9y, and it can be done update-safe in most cases.

Replicating the look and feel of an existing site or even embedding s9y into said site can be a much harder task because it's more complex and there's not many people here experienced with it.

YL
NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Re: Header Plugin for Embedded Blog

Post by NeilW »

Hi YL,
Replicating the look and feel of an existing site or even embedding s9y into said site can be a much harder task because it's more complex and there's not many people here experienced with it.
Yes, I understand what you are saying. I am certainly nowhere near being able to call myself a programmer, but I guess I have built my website with hand coding from the ground up so far as the .css and html go.

But I then have to rely on prebuilt software such as s9y to add much of the functionality.

I understand basic programming constructs and a few basics of php. I use the "require" instruct to allow me to build my site in a more modular manner. I learned very early that if you have just one main menu and one footer and a 100 page web site it is a pain to have to change 100 pages every time you want to add to or change your menu or update your copyright - so teaching myself a bit of php became essential.

So I was able edit the index.tpl file of the theme I am using so that it embeds very comfortably into my site.

The biggest issue that I have found so far is that my site is a membership based site, so that every page needs to have a few lines of php code as the very first thing.

But after setting up the 'indexFile' and "wrapper.php" option of embedding the membership code in the "content.php" template does not work because the s9y 'indexFile' goes before it.

So I have to put the membership code at the very top of the 'indexFile' for the membership pages to work.

On the other side, if I have the membership code as first line in the 'indexFile' the s9y admin pages don't like it and therefore while I can get into the admin area, none of the css renders and it is a real pain to be in.

So I spent most of yesterday coming up with the right "IF/ELSE" statement to be able to make both work and it was not as easy as it sounds because even with the "IF/ELSE" statement there is still a special order of things that you have to figure out.

But that is the sort of code hacker that I am where I do not have the expertise to get in and do something in 5-10 minutes, but after spending all day on it and a lot of trial and error I can figure it out.

I did build this myself though http://mybusiness-mylife.com/global/htm ... xample.php - have a look at it and see if you can figure out how its done. :D

The blog in my public area is here http://mybusiness-mylife.com/global/pr/blog.php and as you will see, so far it integrates very nicely into my site.

In relation to this thread though where I want to be able to manipulate the header code for each blog post, I did enter some of the theme variable's into my "content.php" template - such as the "title" variable, and it did not work.

So therefore I think that confirms that even if the plugins could edit the template the template is not "aware" enough to understand the code.

It is the "index.tpl" file that would have to be edited as I presume it is the embedded area that will pick up things like the 'title". But in that regard I reckon that I will have to add to the embedded code to go right up to the title in the header to do that.

But in truth, I want three areas of the page (header, body and footer) where I want to insert code that will be unique to each post page. On this basis I think that the 'HTML META-Tags' plugin deserves another look.

On the other hand, what is the name of the theme file that would be the one that I would edit to add fields at page level to the backend posting page?

Thanks again,

- Neil
NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Re: Header Plugin for Embedded Blog

Post by NeilW »

Well another day gone and another day of grief.

It seems what I am trying to achieve is totally impossible in the s9y environment. :(

All I want to do is to be able to implant some PHP "require" code into the header of each post page so that I can bring in a new header unique to the page with all of the right meta keys, plus into the footer of the body so that I can bring in page specific social network buttons and into the actual page footer so that I can bring in page specific adverts.

With s9y being PHP based you would think that it should not be that hard, but it seems totally impossible even with the help of the plugins out there or by trying to edit the tpl files.

Even if I could define a separate template file for each blog post it would help as then I could put the links that I want into that. But the fact that there is only one template file totally limits me.

Do you know if this can actually be done or am I fighting a loosing battle?

Kind regards,

- Neil
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Header Plugin for Embedded Blog

Post by yellowled »

NeilW wrote:Do you know if this can actually be done or am I fighting a loosing battle?
Quite frankly, I don't understand half of what you're trying to do here. This is far beyond what I (not a PHP guy myself) have ever done in a s9y blog. This is not how I use s9y, so I can not help here.

But I'm sure Garvin, Ian or onli can.

YL
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Header Plugin for Embedded Blog

Post by Don Chambers »

I might be able to help with this too - but I need a VERY clear understanding of what exactly you are trying to do.
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Header Plugin for Embedded Blog

Post by onli »

yellowled wrote:
NeilW wrote:Do you know if this can actually be done or am I fighting a loosing battle?
But I'm sure Garvin, Ian or onli can.
Neil, let's sit down and talk this through 1:1. I sent you a PM.
Post Reply