Running jekyll with options (lsi) via jekyll-actions?

If the page being processed is a Post, this contains a list of up to ten related Posts. By default, these are the ten most recent posts. For high quality but slow to compute results, run the jekyll command with the --lsi (latent semantic indexing) option. Also note GitHub Pages does not support the lsi option when generating sites.

site.related_posts

I’d like to populate site.related_posts so visitors see actually related posts, not just latest at the bottom of each page.

(side note, not sure what\why LSI, and not just other posts of that tag\category)

anyone have experience running jekyll with specific build flags via github action?

I suppose I can just use the ubuntu action and so forth, but was hoping there was a way to enable flags on jekyll-actions or some other comparable (and much simpler) solution.

another use case would be to enable verbose output, for debugging builds.

thanks!

Update your config.

lsi: true

This is a boolean so omit quotes.

You can find config file options paired with CLI options.

1 Like

I have some resources for using Jekyll on GH Actions if you are interested

1 Like

Thanks for the link, very much! It’s been added to a freshly updated GitHub Pages Starter Pack + Extended Resources.

Thanks also for that tip about adding lsi to config.yml… idk why I didn’t notice that on the page you linked, since i’ve been there a few times looking.

Thanks for sharing. I’m interested to use the info there. It looks comprehensive.

I have collected Jekyll info a repo here

The README has resources and I’ve linked back to your site there.

1 Like

ok, so I tried a few things with no results.

I tried running with the --lsi flag on local serve, same related posts that are just the latest posts
(and yes I did install the https://jekyll.github.io/classifier-reborn/ plugin). I also did try putting lsi: TRUE into my _config.yml, to no avail.

I didn’t try the jekyll-action yet, since I probably should get this working locally before I move to an actions based build.

then I tried this bit of code from Minimal Mistakes issues

 {% comment %}<!-- show posts by related tags when `related: true` -->{% endcomment %}
  {% if page.related %}
    {% assign n_posts = 0 %}
    {% for post in site.posts %}
      {% if post.id == page.id %}{% continue %}{% endif %}
      {% for this_tag in page.tags %}
          {% if post.tags contains this_tag %}
            {% if n_posts == 0 %}
              <div class="page__related">
                {% if site.data.ui-text[site.locale].related_label %}
                  <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
                {% endif %}
                <div class="grid__wrapper">
            {% endif %}
            {% include archive-single.html type="grid" %}
            {% assign n_posts = n_posts | plus: 1 %}
            {% break %}
          {% endif %}
      {% endfor %}
      {% if n_posts > 3 %}{% break %}{% endif %}
    {% endfor %}
    {% if n_posts > 0 %}
        </div>
      </div>
    {% endif %}
  {% endif %}

I also tried this plugin-free ‘solution’ but that left me with no related posts whatsoever.

too tired now, but my next attempt will be to adapt this code into the archive-single.html of minimal mistakes.

I think the problem is that all of my posts are likely to share a tag, so in the end I was getting a very similar most recent sorting.

I modified the code to show posts by related category, instead of tags, which is producing a very satisfactory result.

https://decentralized-id.com (if you want to see it in action)

  {% if page.related %}
    {% assign n_posts = 0 %}
    {% for post in site.posts %}
      {% if post.id == page.id %}{% continue %}{% endif %}
      {% for this_category in page.categories %}
          {% if post.categories contains this_category %}
            {% if n_posts == 0 %}
              <div class="page__related">
                {% if site.data.ui-text[site.locale].related_label %}
                  <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
                {% endif %}
                <div class="grid__wrapper">
            {% endif %}
            {% include archive-single.html type="grid" %}
            {% assign n_posts = n_posts | plus: 1 %}
            {% break %}
          {% endif %}
      {% endfor %}
      {% if n_posts > 3 %}{% break %}{% endif %}
    {% endfor %}
    {% if n_posts > 0 %}
        </div>
      </div>
    {% endif %}
  {% endif %}
</div>

By the way the more Jekyll way than

{% if post.id == page.id %}{% continue %}{% endif %}

Is to do

{% unless post.id == page.id %}
Your code
{% endunless %}

Which is the same as

{% if post.id != page.id %}
Your code
{% endif %}

The unless comes from Ruby

1 Like

good lookin’ out! yeah, I really like the unless provided in ruby, compared with python where I end up relying on a far less graceful “try”

try:
  something
except:
  something else

on a related note, I just moved to jekyll actions and am now serving from gh-pages :crossed_fingers:
it seems pretty hard to mess up :smiley:

I"m looking forward to adding a number of features to the site using actions, such as making a mini feed reader for the blogs of organizations\companies featured on the site, that updates on a weekly basis, even something that will show recent activity in a github organization \ repository, including github issue\pull discussions, a list of recently active repositories, etc.

I’d like to try automating the creation of twitter collections via github actions but that’s harder cause filtering challenges \ data protection.

You could use JS to pull in an RSS or atom feed from blogs.

And GitHub API works within limitations without a token on the frontend

I made a gist viewer

I have a project which gets my repos and their topics in a single graphql query then the data is made available to iterate over with Jekyll for the frontend to render html. I run it manually on Netlify with commit but you can schedule GH Actions to update your site daily or weekly

My site

My Ruby code

Happy to help if you want to use REST or GraphQL to get PRs etc.

1 Like

tbh, for the issues I’m more likely to use something like Huginn. It’s perfect for little micro webscraping, generating rss feeds from whatever you can figure out the css selector \ xcode selector for. (and much more)

haven’t really thought out all the details but I’ve really enjoyed getting a taste for actions… now I know a little code, jekyll itself offers many more possibilities, also.

Interesting. As a self hosted task automator you could trigger an action, whenever there is an external event like RSS feed item

If you’re collecting tweets, blog items etc you could write them to a Google sheet or database, repo commit etc. And use that to build your Jekyll site. Then you use the web scraping part of the tool.