ausminternet / blogprint

a blueprint for blogs with kirby
62 stars 6 forks source link

Is the project active? #2

Open labo-css opened 9 years ago

labo-css commented 9 years ago

I wanted to use it but it seems abandoned.

ausminternet commented 9 years ago

Not so much time at the moment to add the missing todos, but it will work as it is described with the latest kirby version. Do you need some specific feature?

labo-css commented 9 years ago

Disqus & feed are lacking to me. I don't know if it worth more to me to build a blog from scratch or using your work. Didnt have time yet to dive into your code :)

ausminternet commented 9 years ago

Ok, quick and dirty ;)

Use the official feed-plugin from https://github.com/getkirby/plugins/tree/master/feed end replace the template.php with:

<!-- generator="<?php echo $generator ?>" -->
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">

  <channel>
    <title><?php echo xml($title) ?></title>
    <link><?php echo xml($link) ?></link>
    <generator><?php echo c::get('feed.generator', 'Kirby') ?></generator>
    <lastBuildDate><?php echo date('r', $modified) ?></lastBuildDate>
    <atom:link href="<?php echo xml($url) ?>" rel="self" type="application/rss+xml" />

    <?php if(!empty($description)): ?>
    <description><?php echo xml($description) ?></description>
    <?php endif ?>

    <?php foreach($items as $item): ?>
    <item>
      <title><?php echo xml($item->title()) ?></title>
      <link><?php echo xml(getPostUrl($item)) ?></link>
      <guid><?php echo xml(getPostUrl($item)) ?></guid>
      <pubDate><?php echo $datefield == 'modified' ? $item->modified('r') : $item->date('r', $datefield) ?></pubDate>
      <description><![CDATA[<?php echo $item->{$textfield}()->kirbytext() ?>]]></description>
    </item>
    <?php endforeach ?>

  </channel>
</rss>

then put a feed.php inside the content-folder with this inside:

<?php
    echo page('blog/posts')->children()->visible()->limit(10)->feed(array(
        'title'        => 'Your Blogname,
        'link'         => 'blog',
        'url'          => getPostUrl($page),
    ));
?>

for disqus (don't forget to replace YOURSHORTNAME with your short name):

put this inside the section in site/template/post.php after the post-snippet:

 <div id="disqus_thread"></div>
    <script type="text/javascript">

        var disqus_shortname = 'YOURSHORTNAME';
        var disqus_identifier = '<?= $post->slug() ?>';
        var disqus_title = '<?= $post->title()->html() ?>';
        var disqus_url = '<?= getPostUrl($post) ?>';

        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

this inside site/snippets/page-footer.php:

<?php if($page->uid()      == 'posts'
      || $page->uid()      == 'blog'
      || $page->uid()      == 'archive'
      || $page->template() == 'post'): ?>

  <script type="text/javascript">
    var disqus_shortname = 'janhofmansblog';

    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
        s.src = '//' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());

    // called by disqus
    function disqus_config() {
      this.callbacks.onReady = [function() {
        // if your code respond to this event to resize the sidebar
        $(window).trigger('resize');
      }];
    }
    </script>

  <?php endif ?>

this, where you want to see the comment-count:

<a href="<?= getPostUrl($post) ?>#disqus_thread"
         data-disqus-identifier="<?= $post->slug() ?>">
         Kommentare
      </a>

As mentioned: quick and dirty from my own blog, which is based on blogprint.

labo-css commented 9 years ago

Thanx! I'm gonna look at this very soon :+1:

If you need a french localisation (if applicable) for blogprint, i can provide it.