App-LinkSite

 view release on metacpan or  search on metacpan

Changes.md  view on Meta::CPAN

## [0.1.1] - 2026-02-19

### Added

- Missing module

## [0.1.0] - 2026-02-18

### Updated

- Allow configuration of text colour and background colour
- Add support for sections in list of links
- Simply example workflow
- Accept filename as command-line argument

## [0.0.17] - 2025-08-04

### Updated

- Sticky footer

lib/App/LinkSite.pm  view on Meta::CPAN

      name    => $data->{name},
      handle  => $data->{handle},
      image   => $data->{image},
      desc    => $data->{desc},
      og_image => $data->{og_image},
      site_url => $data->{site_url},
      socials => $socials,
      links   => $links,
      sections => $sections,
      $data->{text_color}       ? (text_color => $data->{text_color}) : (),
      $data->{background_color} ? (background_color => $data->{background_color} ) : (),
    );
  }

=head1 METHODS

=head2 run

The main driver method for the process.

=cut

lib/App/LinkSite/Site.pm  view on Meta::CPAN


  use JSON;

  field $name :reader :param;
  field $handle :reader :param;
  field $image :reader :param;
  field $desc :reader :param;
  field $og_image :reader :param;
  field $site_url :reader :param;
  field $text_color :reader :param = undef;
  field $background_color :reader :param = undef;

  field $socials :reader :param = [];
  field $links :reader :param = [];
  field $sections :reader :param = [];

=head1 METHODS

=head2 has_sections

Returns true if the site has any non-empty sections.

src/css/style.css  view on Meta::CPAN

body {
  background: var(--bg-color, #fff);
  color: var(--text-color, #000);
  font-family: Arial, sans-serif;
}
header {
  padding-top: 5%;
}

#img img {
  border-radius: 50%;
  width: 7%;

src/index.html.tt  view on Meta::CPAN

          referrerpolicy="no-referrer" />

    <!-- Bootstrap CSS -->
    <link rel="stylesheet"
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css"
          integrity="sha384-LN+7fdVzj6u52u30Kp6M/trliBMCMKTyK833zpbD+pXdCLuTusPj697FH4R/5mcr"
          crossorigin="anonymous">

    <title>[% site.name %] / @[% site.handle %]</title>
    <link rel="stylesheet" href="/css/style.css">
[% IF site.text_color || site.background_color -%]
    <style>
      :root {
[% IF site.background_color -%]
        --bg-color: [% site.background_color %];
[% END;
   IF site.text_color -%]
        --text-color: [% site.text_color %];
[% END -%]
      }
    </style>
[% END -%]
    <script type="application/ld+json">
[% site.json_ld %]
    </script>
  </head>
  <body style="background: [% site.background_color %]; color: [% site.text_color %];">
    <div class="d-flex flex-column min-vh-100">
      <div class="container-fluid text-center flex-grow-1">
        <header>
[% IF site.image -%]
          <div id="img"><img src="/img/[% site.image %]" alt="[% site.name %] / @[% site.handle %]"></div>
[% END -%]
          <div id="name">
            <h1>[% site.name %] / @[% site.handle %]</h1>
          </div>
          <div id="desc">[% site.desc.replace("\n", '<br>') %]</div>

t/site.t  view on Meta::CPAN

    name     => 'Test Name',
    handle   => 'Test Handle',
    image    => 'test_image.jpg',
    desc     => 'Test Description',
    og_image => 'test_og_image.png',
    site_url => 'http://example.com',
);

# Test default color values (should be undef if not set)
is($site->text_color, undef, 'text_color is undefined by default');
is($site->background_color, undef, 'background_color is undefined by default');

# Test custom color values
my $site2 = App::LinkSite::Site->new(
    name     => 'Test Name',
    handle   => 'Test Handle',
    image    => 'test_image.jpg',
    desc     => 'Test Description',
    og_image => 'test_og_image.png',
    site_url => 'http://example.com',
    text_color => '#123456',
    background_color => '#abcdef',
);
is($site2->text_color, '#123456', 'text_color returns custom value');
is($site2->background_color, '#abcdef', 'background_color returns custom value');
isa_ok($site, 'App::LinkSite::Site', 'Created an App::LinkSite::Site object');

# Test the name method
is($site->name, 'Test Name', 'name method returns "Test Name"');

# Test the handle method
is($site->handle, 'Test Handle', 'handle method returns "Test Handle"');

# Test the image method
is($site->image, 'test_image.jpg', 'image method returns "test_image.jpg"');



( run in 0.859 second using v1.01-cache-2.11-cpan-d8267643d1d )