librelist archives

« back to archive

The Opposite of Including Disqus on Pages

The Opposite of Including Disqus on Pages

From:
Brett Chalupa
Date:
2012-05-17 @ 23:34
Hi all, 

I just switched two of my sites over to Nesta, and I am loving a lot about
it. However, my brain is particularly wracked at the moment, and I can't 
for the life of me think of how to sort this in my head.

Basically, I want to not include Disqus on specific pages.

To include is:

= haml :comments, :layout => false

Is there a simple opposite of this command?

Thanks a bunch,


Brett Chalupa

@brettchalupa (http://twitter.com/brettchalupa)
(908) 652-1140
brettchalupa@gmail.com (mailto:brettchalupa@gmail.com)
http://brettchalupa.com (http://brettchalupa.com/)

Re: [nesta] The Opposite of Including Disqus on Pages

From:
David Long
Date:
2012-05-17 @ 23:38
The opposite is to not have that line of code...

sent from my Android smart phone
On May 17, 2012 7:37 PM, "Brett Chalupa" <brettchalupa@gmail.com> wrote:

> Hi all,
>
> I just switched two of my sites over to Nesta, and I am loving a lot about
> it. However, my brain is particularly wracked at the moment, and I can't
> for the life of me think of how to sort this in my head.
>
> Basically, I want to not include Disqus on specific pages.
>
> To include is:
>
> = haml :comments, :layout => false
>
> Is there a simple opposite of this command?
>
> Thanks a bunch,
>
>
> Brett Chalupa
>
> @brettchalupa <http://twitter.com/brettchalupa>
> (908) 652-1140
> brettchalupa@gmail.com
> http://brettchalupa.com
>
>

Re: [nesta] The Opposite of Including Disqus on Pages

From:
Brian Gonzalez
Date:
2012-05-17 @ 23:53
in your app.rb file, do something like this:

def enable_comments?
  !['/', '/about', '/projects'].include? request.path
end

then change the line = haml :comments, :layout => false to

= haml :comments, :layout => false if enable_comments?

Whichever path you put inside ['/', '/about', '/projects'] array will not
include the disqus snippet.

-
Brian Gonzalez
briangonzalez.org

On Thu, May 17, 2012 at 11:38 PM, David Long <dave@davejlong.com> wrote:

> The opposite is to not have that line of code...
>
> sent from my Android smart phone
> On May 17, 2012 7:37 PM, "Brett Chalupa" <brettchalupa@gmail.com> wrote:
>
>> Hi all,
>>
>> I just switched two of my sites over to Nesta, and I am loving a lot
>> about it. However, my brain is particularly wracked at the moment, and I
>> can't for the life of me think of how to sort this in my head.
>>
>> Basically, I want to not include Disqus on specific pages.
>>
>> To include is:
>>
>> = haml :comments, :layout => false
>>
>> Is there a simple opposite of this command?
>>
>> Thanks a bunch,
>>
>>
>> Brett Chalupa
>>
>> @brettchalupa <http://twitter.com/brettchalupa>
>> (908) 652-1140
>> brettchalupa@gmail.com
>> http://brettchalupa.com
>>
>>

Re: [nesta] The Opposite of Including Disqus on Pages

From:
Graham Ashton
Date:
2012-05-18 @ 00:45
On 18 May 2012, at 00:53, Brian Gonzalez <me@briangonzalez.org> wrote:

> in your app.rb file, do something like this:
> 
> def enable_comments?
>   !['/', '/about', '/projects'].include? request.path
> end

Neat. You've given me an idea. You could change the method to this:

def enable_comments?
  @page.flagged_as?('commented')
end

Then add the flag on pages that should be commented by setting the flags metadata:

Flags: commented

If commented pages are the norm that would be a chore, so just change the 
flag to "uncommented" and reverse the if statement in the enable_comments?
method.

Docs:

http://nestacms.com/docs/creating-content/metadata-reference#flags

Re: [nesta] The Opposite of Including Disqus on Pages

From:
Brian Gonzalez
Date:
2012-05-18 @ 00:49
Cool, didn't know about all of the metadata features.

On Fri, May 18, 2012 at 12:45 AM, Graham Ashton <graham@effectif.com> wrote:

> On 18 May 2012, at 00:53, Brian Gonzalez <me@briangonzalez.org> wrote:
>
> > in your app.rb file, do something like this:
> >
> > def enable_comments?
> >   !['/', '/about', '/projects'].include? request.path
> > end
>
> Neat. You've given me an idea. You could change the method to this:
>
> def enable_comments?
>  @page.flagged_as?('commented')
> end
>
> Then add the flag on pages that should be commented by setting the flags
> metadata:
>
> Flags: commented
>
> If commented pages are the norm that would be a chore, so just change the
> flag to "uncommented" and reverse the if statement in the enable_comments?
> method.
>
> Docs:
>
> http://nestacms.com/docs/creating-content/metadata-reference#flags
>

Re: [nesta] The Opposite of Including Disqus on Pages

From:
Brett Chalupa
Date:
2012-05-18 @ 03:23
This solution works very well, and it was just what I was looking for.

Thanks a bunch! 

Brett Chalupa

@brettchalupa (http://twitter.com/brettchalupa)
(908) 652-1140
brettchalupa@gmail.com (mailto:brettchalupa@gmail.com)
http://brettchalupa.com (http://brettchalupa.com/)


On Thursday, May 17, 2012 at 8:45 PM, Graham Ashton wrote:

> On 18 May 2012, at 00:53, Brian Gonzalez <me@briangonzalez.org 
(mailto:me@briangonzalez.org)> wrote:
> 
> > in your app.rb file, do something like this:
> > 
> > def enable_comments?
> > !['/', '/about', '/projects'].include? request.path
> > end
> > 
> 
> 
> Neat. You've given me an idea. You could change the method to this:
> 
> def enable_comments?
> @page.flagged_as?('commented')
> end
> 
> Then add the flag on pages that should be commented by setting the flags
metadata:
> 
> Flags: commented
> 
> If commented pages are the norm that would be a chore, so just change 
the flag to "uncommented" and reverse the if statement in the 
enable_comments? method.
> 
> Docs:
> 
> http://nestacms.com/docs/creating-content/metadata-reference#flags