<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anastasiia_Berest</title>
    <description>The latest articles on DEV Community by Anastasiia_Berest (@anastasiia_xfr).</description>
    <link>https://dev.to/anastasiia_xfr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1028720%2Fa556c6dc-7a98-4529-9da3-69170833f3a9.png</url>
      <title>DEV Community: Anastasiia_Berest</title>
      <link>https://dev.to/anastasiia_xfr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anastasiia_xfr"/>
    <language>en</language>
    <item>
      <title>[Sass]: Simple dot animation</title>
      <dc:creator>Anastasiia_Berest</dc:creator>
      <pubDate>Sun, 24 Dec 2023 13:35:04 +0000</pubDate>
      <link>https://dev.to/anastasiia_xfr/sass-simple-dot-animation-5fje</link>
      <guid>https://dev.to/anastasiia_xfr/sass-simple-dot-animation-5fje</guid>
      <description>&lt;p&gt;And I found my old pet project when I was interested in Sass. Well, this looks not very organic or rhythmic, not Brownian motion.&lt;/p&gt;

&lt;p&gt;Pug:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- for (var x = 0; x &amp;lt; 11; x++)
  div.b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sass:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.b
  width: 10vmin
  height: 10vmin
  border-radius: 50%
  position: absolute
  top: 0
  left: 0
  animation-iteration-count: infinite 
  animation-direction: alternate
  animation-timing-function: linear
  animation-fill-mode: backwards
@for $i from 1 through 15
  @keyframes anm#{$i}
    0% 
      left: 10vmin
      top: 10vmin
      opacity: 0
    100%
      left: random(250)+vmin
      top: random(250)+vmin
      transform: scale(random(3))
  .b:nth-child(#{$i})
    animation-name: anm#{$i}
    animation-duration: random(20)+s
    animation-delay: $i/10 +s 
    background: linear-gradient(45deg, rgb(random(255), random(255), random(255)), rgb(random(255), random(255), random(255)))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://codepen.io/slevin2017/pen/yLbjLBR"&gt;codepen_ex&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Hugo]: Strapi CMS And Hugo integration</title>
      <dc:creator>Anastasiia_Berest</dc:creator>
      <pubDate>Fri, 14 Jul 2023 13:36:59 +0000</pubDate>
      <link>https://dev.to/anastasiia_xfr/strapi-cms-and-hugo-integration-f0o</link>
      <guid>https://dev.to/anastasiia_xfr/strapi-cms-and-hugo-integration-f0o</guid>
      <description>&lt;p&gt;Hi there!&lt;br&gt;
First, what you need to know is that you can fetch data from the Strapi API using JavaScript.&lt;/p&gt;

&lt;p&gt;In this test project, we are using &lt;a href="https://render.com/"&gt;Render.com&lt;/a&gt; to deploy the Strapi database and &lt;a href="https://www.netlify.com/"&gt;Netlify.com&lt;/a&gt; to deploy the Hugo frontend.&lt;/p&gt;

&lt;p&gt;[1] Create &lt;a href="https://dashboard.render.com/new/database"&gt;database&lt;/a&gt; in Render.com  watch the &lt;a href="https://youtu.be/akvItcWW81g"&gt;video&lt;/a&gt;. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; strapi-v0&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; sample&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User:&lt;/strong&gt; admin&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Region:&lt;/strong&gt; Oregon&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Datadog API Key:&lt;/strong&gt; [nothing]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance Type:&lt;/strong&gt; free&lt;/li&gt;
&lt;li&gt;click button Create Database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;[2] Install Strapi for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-strapi-app@4.11.4 my-project
- instalation type: Custom
- preferred language: JavaScript
- default database: postgres
and from render.com select your db data:
- database name: sample_5rhn
- host: dpg-cinr7slgkuvudif7bedg-a.frankfurt-postgres.render.com (External Database URL: value after @ and include last .com)
- port: 5432
- username: admin
- password: ahrhvB6JCLPXcZovPsIjXVd3Yl9q4Zdj (render password)
- enable ssl: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lrt4m9Ly--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgyiio7rzgqf7a7l1k49.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lrt4m9Ly--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgyiio7rzgqf7a7l1k49.jpg" alt="Image description" width="800" height="446"&gt;&lt;/a&gt;&lt;br&gt;
Do &lt;code&gt;cd my-project&lt;/code&gt; and run &lt;code&gt;npn run develop&lt;/code&gt; and sign up.&lt;/p&gt;

&lt;p&gt;[3] Add entries in Strapi admin:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to Settings &amp;gt; &lt;a href="http://localhost:1337/admin/settings/internationalization"&gt;Internationalization&lt;/a&gt; and add other language &amp;gt; click save button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Content-type-builder and create &lt;strong&gt;Single Type&lt;/strong&gt; like About and Term with field title (text) and content (rich text).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fQRzLzpq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebxkj4nnwkmhfrs0q5ni.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fQRzLzpq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebxkj4nnwkmhfrs0q5ni.jpg" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;strong&gt;Edit&lt;/strong&gt; button near collection Name go to tab &lt;strong&gt;Advanced settings&lt;/strong&gt; and checked &lt;strong&gt;Internationalization&lt;/strong&gt; field.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dHSV4FDh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmj7fnvgfl0vsinjblxw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dHSV4FDh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmj7fnvgfl0vsinjblxw.jpg" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go &lt;a href="http://localhost:1337/admin/settings/users-permissions/roles/2"&gt;to&lt;/a&gt; Settings &amp;gt; USERS &amp;amp; PERMISSIONS PLUGIN &amp;gt; Roles &amp;gt; Public &amp;gt; choose your Entries (About, Terms) and checked find input.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;strong&gt;Content Manager&lt;/strong&gt; About and paste some text there. Check it like &lt;a href="http://localhost:1337/api/about?locale=fr&amp;amp;populate=*"&gt;http://localhost:1337/api/about?locale=fr&amp;amp;populate=*&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;[4] Add Hugo template:&lt;br&gt;
I use for this &lt;a href="https://github.com/themefisher/dot-hugo"&gt;Dot Hugo Theme&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;At first we need add to config.toml
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[params]
# !!! The Strapi server URL !!!
StrapiServerURL = 'https://strapi-hugo-v1.onrender.com/api'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;In &lt;strong&gt;layouts/partials&lt;/strong&gt; add strapi-content.html and content-after.html&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;strapi-content.html&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Partial to fetch content from Strapi. --&amp;gt;

{{ $endpoint := $.Param "endpoint" }}
{{ $data := dict "title" "" "content" "" }}

{{ if and $endpoint .Site.Params.StrapiServerURL }}

{{ $contentURL := printf "%s%s" .Site.Params.StrapiServerURL $endpoint }}
{{ $data = getJSON $contentURL }}

{{ end }}

{{ $data }}

{{ return $data }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;content-after.html&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{ $strapiData := partial "strapi-content" . }}

{{ if $strapiData }}
&amp;lt;article class="markdown"&amp;gt;
  {{/*  &amp;lt;h1&amp;gt;{{ $strapiData.title }}&amp;lt;/h1&amp;gt;  */}}

  &amp;lt;div class="mt-4"&amp;gt;
    {{ $strapiData.data.attributes.content | markdownify }}
  &amp;lt;/div&amp;gt;
&amp;lt;/article&amp;gt;
{{  end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add to &lt;strong&gt;/dot/layouts/partials/default.html&lt;/strong&gt; or &lt;strong&gt;/layouts/_default/list.html&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; {{ partial "content-after.html" . }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create in Content &lt;strong&gt;dot\content&lt;/strong&gt; folrder about and folder terms with _index.en.md and _index.fr.md
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
title: "About Us EN"
endpoint: "/about?locale=en"
---

&amp;lt;br/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;in config.toml Check if languages added:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S2rRTH7r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4vi748fpe2q6ed08wze.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S2rRTH7r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4vi748fpe2q6ed08wze.jpg" alt="Image description" width="800" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[5] Publick strapi folder with hugo theme folder inside to github.&lt;br&gt;
[6] Choose your repository in render &lt;strong&gt;&lt;a href="https://dashboard.render.com/select-repo?type=web"&gt;Create a new Web Service&lt;/a&gt;&lt;/strong&gt; don't forgot your .env local variables &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IEZVgX1C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2xyv1b6j4eympr0tewe.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IEZVgX1C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2xyv1b6j4eympr0tewe.jpg" alt="Image description" width="800" height="334"&gt;&lt;/a&gt;&lt;br&gt;
Add or .env like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HOST=0.0.0.0
PORT=1337
APP_KEYS=Qou0bjHyhL/cOmRvQUCyrw==,9SwSrmPSfBsZFPYGGVH+Tw==,w9m8P+0A0r+Vq2bk7p93uw==,c5+P9PwXVgHiNAuOjT1Kog==
API_TOKEN_SALT=+LDbAS4rDx/lJ10uLWcxCw==
ADMIN_JWT_SECRET=+qIl5IOcV/44HYGCSHKi4A==
JWT_SECRET=P3pmatNaY0rFyK6xVSLl9w==
CLOUDINARY_KEY=523224738358411
CLOUDINARY_NAME=dzmcv05wy
CLOUDINARY_SECRET=-dZ793AJNiHbkTIRElvFmsjlHtk
DATABASE_CLIENT=postgres
DATABASE_HOST=dpg-cinr7slgkuvudif7bedg-a.frankfurt-postgres.render.com
DATABASE_NAME=sample_5rhn
DATABASE_PASSWORD=ahrhvB6JCLPXcZovPsIjXVd3Yl9q4Zdj
DATABASE_PORT=5432
DATABASE_SSL=true
DATABASE_USERNAME=admin
TRANSFER_TOKEN_SALT=qMa3hHbA1p1TrnzR3Q4dTQ==

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[7] Add Hugo to &lt;a href="https://www.netlify.com/"&gt;Netlify.com&lt;/a&gt; with deploy command &lt;code&gt;hugo --ignoreCache --gc --minify&lt;/code&gt; for my case: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;all strapi there &lt;a href="https://github.com/anastasiiaxfr/strapi-hugo-v1"&gt;https://github.com/anastasiiaxfr/strapi-hugo-v1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hugo there: &lt;a href="https://github.com/anastasiiaxfr/strapi-hugo-v1/tree/main/dot"&gt;folder dot&lt;/a&gt;
and on Netlify I add dot folder there&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oBdTaoZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yh3ewlst1m8qvxowvi8y.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oBdTaoZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yh3ewlst1m8qvxowvi8y.jpg" alt="Image description" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[8] Add &lt;a href="https://dev.tourl"&gt;Netlify Build hook&lt;/a&gt; for Strapi update (&lt;a href="https://chriswray.dev/posts/triggering-a-deploy-in-netlify-automatically-after-updating-content-in-strapi"&gt;read&lt;/a&gt;): go to Netlify Deployment Setting &amp;gt; &lt;a href="https://docs.netlify.com/configure-builds/build-hooks/"&gt;Build Hooks&lt;/a&gt; and add then copy this hook to &lt;strong&gt;Strapi &amp;gt; Settings &amp;gt; Webhooks&lt;/strong&gt; and save it. Reload About entry and look at demo on Hugo Netlify.&lt;/p&gt;

&lt;p&gt;That's all)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strapi:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://strapi-hugo-v1.onrender.com/admin"&gt;admin&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;login: &lt;a href="mailto:anastasiiaberest@gmail.com"&gt;anastasiiaberest@gmail.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;password: Tg6x-ctg6x&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hugo:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://strapi-hugo-v1.netlify.app/about/"&gt;about&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Git:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/anastasiiaxfr/strapi-hugo-v1"&gt;strapi-hugo-v1&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;For &lt;a href="https://cloudinary.com/"&gt;cloudinary&lt;/a&gt; add &lt;strong&gt;my-project/config/plugin.js&lt;/strong&gt; with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = ({ env }) =&amp;gt; ({
  upload: {
    config: {
      provider: "cloudinary",
      providerOptions: {
        cloud_name: env("CLOUDINARY_NAME"),
        api_key: env("CLOUDINARY_KEY"),
        api_secret: env("CLOUDINARY_SECRET"),
      },
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
      },
    },
  },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and &lt;strong&gt;my-project/config/middlewares.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = [
  'strapi::errors',
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': ["'self'", 'data:', 'blob:', 'market-assets.strapi.io', 'res.cloudinary.com'],
          'media-src': [
            "'self'",
            'data:',
            'blob:',
            'market-assets.strapi.io',
            'res.cloudinary.com',
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::logger',
  'strapi::query',
  'strapi::body',
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
];

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>[HUGO]: How to use variables from .env</title>
      <dc:creator>Anastasiia_Berest</dc:creator>
      <pubDate>Sat, 03 Jun 2023 21:27:33 +0000</pubDate>
      <link>https://dev.to/anastasiia_xfr/hugo-how-use-variables-from-env-3k1i</link>
      <guid>https://dev.to/anastasiia_xfr/hugo-how-use-variables-from-env-3k1i</guid>
      <description>&lt;p&gt;The initial task you need to accomplish on Hugo is how to add variables from .env to JavaScript when building the site using &lt;strong&gt;hugo server&lt;/strong&gt; or &lt;strong&gt;hugo --gc --minify&lt;/strong&gt; after deploying on Netlify.&lt;br&gt;
And what I understand after researching for this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;touch .env file and add variables with names that start with HUGO_PARAMS_ as required &lt;a href="https://discourse.gohugo.io/t/access-netlify-environment-variable-in-shortcode/37692/12"&gt;read&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add to config.toml&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[security]
  enableInlineShortcodes = false
  [security.funcs]
    getenv = ['^HUGO_']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add to Netlify Deploy Environment variables from .env&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add to \layouts_default\baseof.html something like this&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script&amp;gt;
const apiKey = "{{ getenv "HUGO_PARAMS_FIREBASE_API_KEY" }}";
//console.log('apiKey', apiKey);
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Deploy that
That's all, it will be a success.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run it locally, you will need to write all the variables in the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;env HUGO_TITLE="Some Title" hugo server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(I couldn't find any other way, and it's terribly inconvenient)&lt;br&gt;
&lt;a href="https://github.com/gohugoio/hugo/issues/6276"&gt;read&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Sources: &lt;a href="https://gohugo.io/getting-started/configuration/#configure-with-environment-variables"&gt;1&lt;/a&gt; &lt;a href="https://gohugo.io/functions/getenv/"&gt;2&lt;/a&gt; &lt;a href="https://gohugo.io/about/security-model/#security-policy"&gt;3&lt;/a&gt; &lt;a href="https://discourse.gohugo.io/t/access-netlify-environment-variable-in-shortcode/37692/11"&gt;4&lt;/a&gt;&lt;/p&gt;

</description>
      <category>hugo</category>
      <category>env</category>
      <category>security</category>
    </item>
    <item>
      <title>[Sass]: Font mixin</title>
      <dc:creator>Anastasiia_Berest</dc:creator>
      <pubDate>Sun, 19 Mar 2023 10:26:17 +0000</pubDate>
      <link>https://dev.to/anastasiia_xfr/sass-font-mixin-53k2</link>
      <guid>https://dev.to/anastasiia_xfr/sass-font-mixin-53k2</guid>
      <description>&lt;p&gt;Hi. Today I will show you my Sass mixin to generate a font and how to add it from the local assets folder.&lt;/p&gt;

&lt;p&gt;[1]. For generate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ffBack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji","Segoe UI Symbol", "Noto Color Emoji"

=ft($fz, $lh: 16, $fw: inherit, $ff: null) 
  $lh: $lh/$fz
  $fz: $fz/16 + rem

  @if($ff) 
    $family: $ff, $ffBack
    font: $fw $fz/$lh $family

  @else 
    font-weight: $fw
    font-size: $fz
    line-height: $lh

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And for usage, we just call it a mixin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;h1
  +ft(32, 38, 700)

h2
  +ft(28, 32, 700, "Inter")  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks like this &lt;a href="https://codepen.io/anastasiiaxfr/pen/GRXBPdG"&gt;CSS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;[2]. Add font from local assets folder (compiled styles and font folders inside assets) [&lt;a href="https://codepen.io/anastasiiaxfr/pen/RwYBvov"&gt;code&lt;/a&gt;]:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$fontSrc: '../fonts'

$fntName: (Montserrat-Black, 900), (Montserrat-Bold, 700), (Montserrat-SemiBold, 600), (Montserrat-Medium, 500), (Montserrat-Regular, 400), (Montserrat-Light, 300)

=font($fntName, $fntSrc)    
    @each $fnt, $fntw in $fntName
        @font-face 
            $fntFldr: 'Montserrat'
            font-family: '' + $fnt + ''
            font-style: normal
            font-weight: #{$fntw}
            font-display: swap
            src: local('' + $fnt + ''), local('' + $fnt + ''), url($fontSrc + '/' + $fntFldr + '/' +'#{$fnt}.woff') format('woff'), url($fontSrc + '/' + $fntFldr + '/' +'#{$fnt}.woff2') format('woff2'), url($fontSrc + '/' + $fntFldr + '/' +'#{$fnt}.ttf') format('ttf')

+font($fntName, $fontSrc)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I_dbBdx1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/372hsuni0mvgc2hytx0f.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I_dbBdx1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/372hsuni0mvgc2hytx0f.jpg" alt="Image description" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Hugo]: Pagination</title>
      <dc:creator>Anastasiia_Berest</dc:creator>
      <pubDate>Sat, 18 Mar 2023 15:53:39 +0000</pubDate>
      <link>https://dev.to/anastasiia_xfr/hugo-pagination-1ip4</link>
      <guid>https://dev.to/anastasiia_xfr/hugo-pagination-1ip4</guid>
      <description>&lt;p&gt;Hi.  Today I show you my Hugo SSG pagination template (go to &lt;strong&gt;/layouts/partials/_pagination.html&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
 {{ $paginator := .Paginator }}
  &amp;lt;!-- Number of links either side of the current page. --&amp;gt;
  {{ $adjacent_links := 2 }}
  &amp;lt;!-- $max_links = ($adjacent_links * 2) + 1 --&amp;gt;
  {{ $max_links := (add (mul $adjacent_links 2) 1) }}
  &amp;lt;!-- $lower_limit = $adjacent_links + 1 --&amp;gt;
  {{ $lower_limit := (add $adjacent_links 1) }}
  &amp;lt;!-- $upper_limit = $paginator.TotalPages - $adjacent_links --&amp;gt;
  {{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }}
  &amp;lt;!-- If there's more than one page. --&amp;gt;
  {{ if gt $paginator.TotalPages 1 }}
  &amp;lt;nav aria-label="Page navigation"&amp;gt;
    &amp;lt;ul class="pagination justify-content-center"&amp;gt;
      &amp;lt;!-- First page. --&amp;gt;
      {{ if ne $paginator.PageNumber 1 }}
      &amp;lt;li class="page-item"&amp;gt;
        &amp;lt;a class="page-link hover-ripple" href="{{ $paginator.First.URL }}"&amp;gt;
          ««
        &amp;lt;/a&amp;gt;
      &amp;lt;/li&amp;gt;
      {{ end }}
      &amp;lt;!-- Previous page. --&amp;gt;
      {{ if $paginator.HasPrev }}
      &amp;lt;li class="page-item"&amp;gt;
        &amp;lt;a href="{{ $paginator.Prev.URL }}" class="page-link hover-ripple"&amp;gt;
          «
        &amp;lt;/a&amp;gt;
      &amp;lt;/li&amp;gt;
      {{ end }}
      &amp;lt;!-- Page numbers. --&amp;gt;
      {{ range $paginator.Pagers }}
      {{ $.Scratch.Set "page_number_flag" false }}
      &amp;lt;!-- Advanced page numbers. --&amp;gt;
      {{ if gt $paginator.TotalPages $max_links }}
      &amp;lt;!-- Lower limit pages. --&amp;gt;
      &amp;lt;!-- If the user is on a page which is in the lower limit.  --&amp;gt;
      {{ if le $paginator.PageNumber $lower_limit }}
      &amp;lt;!-- If the current loop page is less than max_links. --&amp;gt;
      {{ if le .PageNumber $max_links }}
      {{ $.Scratch.Set "page_number_flag" true }}
      {{ end }}
      &amp;lt;!-- Upper limit pages. --&amp;gt;
      &amp;lt;!-- If the user is on a page which is in the upper limit. --&amp;gt;
      {{ else if ge $paginator.PageNumber $upper_limit }}
      &amp;lt;!-- If the current loop page is greater than total pages minus $max_links --&amp;gt;
      {{ if gt .PageNumber (sub $paginator.TotalPages $max_links) }}
      {{ $.Scratch.Set "page_number_flag" true }}
      {{ end }}
      &amp;lt;!-- Middle pages. --&amp;gt;
      {{ else }}
      {{ if and ( ge .PageNumber (sub $paginator.PageNumber $adjacent_links) ) ( le .PageNumber (add $paginator.PageNumber $adjacent_links) ) }}
      {{ $.Scratch.Set "page_number_flag" true }}
      {{ end }}
      {{ end }}
      &amp;lt;!-- Simple page numbers. --&amp;gt;
      {{ else }}
      {{ $.Scratch.Set "page_number_flag" true }}
      {{ end }}
      &amp;lt;!-- Output page numbers. --&amp;gt;
      {{ if eq ($.Scratch.Get "page_number_flag") true }}
      &amp;lt;li class="page-item{{ if eq . $paginator }} page-item active {{ end }}"&amp;gt;
        &amp;lt;a href="{{ .URL }}" class="page-link hover-ripple"&amp;gt;
          {{ .PageNumber }}
        &amp;lt;/a&amp;gt;
      &amp;lt;/li&amp;gt;
      {{ end }}
      {{ end }}
      &amp;lt;!-- Next page. --&amp;gt;
      {{ if $paginator.HasNext }}
      &amp;lt;li class="page-item"&amp;gt;
        &amp;lt;a href="{{ $paginator.Next.URL }}" class="page-link hover-ripple"&amp;gt;
          »
        &amp;lt;/a&amp;gt;
      &amp;lt;/li&amp;gt;
      {{ end }}
      &amp;lt;!-- Last page. --&amp;gt;
      {{ if ne $paginator.PageNumber $paginator.TotalPages }}
      &amp;lt;li class="page-item"&amp;gt;
        &amp;lt;a class="page-link hover-ripple" href="{{ $paginator.Last.URL }}"&amp;gt;
          »»
        &amp;lt;/a&amp;gt;
      &amp;lt;/li&amp;gt;
      {{ end }}
    &amp;lt;/ul&amp;gt;
  &amp;lt;/nav&amp;gt;
  {{ end }}
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forget to include the count of posts that will be displayed per page in config.toml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# post pagination
paginate = "8"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In folder layouts inside your collection type (section) in list.html, include our pagination template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class=""&amp;gt;

   &amp;lt;div class=""&amp;gt;
    {{ $paginator := .Paginate .Data.Pages }}
    {{ range $paginator.Pages }}
    {{ "&amp;lt;!-- blog post --&amp;gt;" | safeHTML }}
    &amp;lt;article class=""&amp;gt;
      {{ .Render "post"}}
    &amp;lt;/article&amp;gt;
    {{ end }}
   &amp;lt;/div&amp;gt;

   {{"&amp;lt;!-- pagination --&amp;gt;" | safeHTML }}
   {{- partial "_pagination.html" . -}}
   {{"&amp;lt;!-- /pagination --&amp;gt;" | safeHTML }}

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hugo SSG official &lt;a href="https://gohugo.io/templates/pagination/"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Hugo]: Sitemap.xml</title>
      <dc:creator>Anastasiia_Berest</dc:creator>
      <pubDate>Sat, 18 Mar 2023 15:25:49 +0000</pubDate>
      <link>https://dev.to/anastasiia_xfr/hugo-sitemapxml-230a</link>
      <guid>https://dev.to/anastasiia_xfr/hugo-sitemapxml-230a</guid>
      <description>&lt;p&gt;Hi. Today I will show you my Hugo template for generation Sitemap.xml.&lt;/p&gt;

&lt;p&gt;First what you must do is go to: &lt;strong&gt;layouts/_defaul&lt;/strong&gt;t and create sitemap.xml. The code inside look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{ printf "&amp;lt;?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?&amp;gt;" | safeHTML }}
&amp;lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"&amp;gt;
  {{ range .Data.Pages }}
  &amp;lt;url&amp;gt;
    &amp;lt;loc&amp;gt;{{ .RelPermalink }}&amp;lt;/loc&amp;gt;
    {{ if not .Lastmod.IsZero }}
    &amp;lt;lastmod&amp;gt;
    {{ safeHTML ( .Lastmod.Format "20018-01-02T15:04:05-07:00" ) }}
    &amp;lt;/lastmod&amp;gt;
    {{ end }}

    {{ with .Sitemap.ChangeFreq }}
    &amp;lt;changefreq&amp;gt;{{ . }}&amp;lt;/changefreq&amp;gt;
    {{ end }}

    {{ if ge .Sitemap.Priority 0.0 }}


    {{ if eq .RelPermalink .Site.BaseURL }}

    &amp;lt;priority&amp;gt; 1 &amp;lt;/priority&amp;gt;

    {{ end }}


    {{ $urlCheck := .RelPermalink | relURL }}
    {{ $urlSub2 := findRE "([^/]+).*" .RelPermalink 1 }}

    {{ $urlSubFix := replaceRE "[^/]*?((?:/[^/]*?){2})$" "$1" .RelPermalink }}


    {{ if eq $urlCheck $urlSubFix  }}
    &amp;lt;priority&amp;gt; 0.8 &amp;lt;/priority&amp;gt;
    {{ end }}


    {{ if not ( eq .RelPermalink .Site.BaseURL | or ( eq $urlCheck $urlSubFix )) }}
    &amp;lt;priority&amp;gt; 0.6 &amp;lt;/priority&amp;gt;
    {{ end }}


    {{ end }}

    {{ if .IsTranslated }}{{ range .Translations }}
    &amp;lt;xhtml:link
      rel="alternate"
      hreflang="{{ .Lang }}"
      href="{{ .RelPermalink }}"
      /&amp;gt;{{ end }}
      &amp;lt;xhtml:link
        rel="alternate"
        hreflang="{{ .Lang }}"
        href="{{ .RelPermalink }}"
        /&amp;gt;{{ end }}
      &amp;lt;/url&amp;gt;
      {{ end }}
    &amp;lt;/urlset&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forgot paste inside root folder in file &lt;strong&gt;config.toml&lt;/strong&gt; this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[sitemap]
ChangeFreq = "daily"
Priority = 0.6
Weight = [["main", "1"], ["sub2", "0.8"], ["sub3", "0.6"]]
enableRobotsTXT = true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result sitemap looks like this: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7oujZ6Io--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wd4xh2zogb3rknjkcsjw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7oujZ6Io--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wd4xh2zogb3rknjkcsjw.jpg" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have for main page priority index 1, for pages level 1, like &lt;em&gt;/section/&lt;/em&gt; - priority 0.8 and for pages level 2, like &lt;em&gt;/section/posts&lt;/em&gt; - priority 0.6.&lt;br&gt;
$urlSubFix - check url like &lt;em&gt;/section/posts/&lt;/em&gt; and save only &lt;em&gt;/posts/&lt;/em&gt; (priority 0.6) and for url like &lt;em&gt;/section/&lt;/em&gt; it saves &lt;em&gt;/section/&lt;/em&gt; (priority 0.8), it makes the pattern in $urlSubFix &lt;a href="https://regex101.com/r/8QFOSf/1"&gt;regexp&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hugo SSG official documentation for &lt;a href="https://gohugo.io/templates/sitemap-template/"&gt;sitemap&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
